@@ -42,11 +42,7 @@ def _annot_clone(ax: plt.Axes, x: float, y: float, annot: str,
4242 # Let's assume cex is a multiplier for a default reasonable size e.g., 8
4343 fontsize = plt .rcParams ['font.size' ] * cex # Scale default font size
4444
45- # Basic offset implementation:
46- # Calculate offset in display coordinates (pixels) and convert back? Simpler:
47- # Approximate offset in data coordinates based on position.
48- # This is a rough heuristic. A fixed pixel offset would be more robust but complex.
49- # Let's use a fraction of axis range as offset unit.
45+ # Basic offset implementation (use a fraction of axis range as offset unit)
5046 x_range = ax .get_xlim ()[1 ] - ax .get_xlim ()[0 ]
5147 y_range = ax .get_ylim ()[1 ] - ax .get_ylim ()[0 ]
5248 offset_scale_x = x_range * 0.01 # Scale offset relative to x-axis range
@@ -68,15 +64,16 @@ def _annot_clone(ax: plt.Axes, x: float, y: float, annot: str,
6864 # Outline with white, adjust linewidth as needed
6965 path_effects = [pe .withStroke (linewidth = 1.5 , foreground = 'white' )]
7066
71- ax .text (x + x_off , y + y_off , annot , # Apply offset
72- ha = ha , va = va ,
73- rotation = angle ,
74- color = col ,
75- fontsize = fontsize ,
76- rotation_mode = 'anchor' , # Rotate around the anchor point (ha/va)
77- transform = ax .transData ,
78- path_effects = path_effects # Add path effects
79- )
67+ ax .text (
68+ x + x_off , y + y_off , annot , # Apply offset
69+ ha = ha , va = va ,
70+ rotation = angle ,
71+ color = col ,
72+ fontsize = fontsize ,
73+ rotation_mode = 'anchor' , # Rotate around the anchor point (ha/va)
74+ transform = ax .transData ,
75+ path_effects = path_effects # Add path effects
76+ )
8077
8178
8279def _draw_clust_polygon (ax : plt .Axes , xpos : np .ndarray , ytop : np .ndarray , ybtm : np .ndarray ,
@@ -197,9 +194,7 @@ def _draw_clust_spline(ax: plt.Axes, xpos: np.ndarray, ytop: np.ndarray, ybtm: n
197194 print ("Skipping drawing for clone with no timepoints." ) # Mimic R warning
198195 return
199196 if len (xpos ) < 2 :
200- # Cannot draw spline with < 2 points, draw as polygon?
201- # Or just skip/draw a point? R's spline might handle this.
202- # For now, draw simple polygon if only 1 point.
197+ # draw simple polygon if only 1 point
203198 if len (xpos ) == 1 :
204199 _draw_clust_polygon (ax , xpos , ytop , ybtm , color , nest_level , pad_left ,
205200 border , col_border , ramp_angle = 0.5 , # Use default ramp
0 commit comments