@@ -548,9 +548,11 @@ def add_label_clabeltext(self, x, y, rotation, lev, cvalue):
548
548
def add_label_near (self , x , y , inline = True , inline_spacing = 5 ,
549
549
transform = None ):
550
550
"""
551
- Add a label near the point (x, y) of the given transform.
552
- If transform is None, data transform is used. If transform is
553
- False, IdentityTransform is used.
551
+ Add a label near the point (x, y). If transform is None
552
+ (default), (x, y) is in data coordinates; if transform is
553
+ False, (x, y) is in display coordinates; otherwise, the
554
+ specified transform will be used to translate (x, y) into
555
+ display coordinates.
554
556
555
557
*inline*:
556
558
controls whether the underlying contour is removed or
@@ -562,15 +564,11 @@ def add_label_near(self, x, y, inline=True, inline_spacing=5,
562
564
exact for labels at locations where the contour is
563
565
straight, less so for labels on curved contours.
564
566
"""
565
- # if 'do the default thing' use the axes data transform
567
+
566
568
if transform is None :
567
569
transform = self .ax .transData
568
570
569
- # if transform is 'falsey' don't do any transform (this is a
570
- # really awful API but is what we have)
571
571
if transform :
572
- # The point of this transform is to get the location
573
- # of label position into screen units
574
572
x , y = transform .transform_point ((x , y ))
575
573
576
574
# find the nearest contour _in screen units_
@@ -586,8 +584,7 @@ def add_label_near(self, x, y, inline=True, inline_spacing=5,
586
584
active_path = paths [segmin ]
587
585
# grab it's verticies
588
586
lc = active_path .vertices
589
- # sort out where the new vertex should be added in the path's data
590
- # units
587
+ # sort out where the new vertex should be added data-units
591
588
xcmin = self .ax .transData .inverted ().transform_point ([xmin , ymin ])
592
589
# if there isn't a vertex close enough
593
590
if not np .allclose (xcmin , lc [imin ]):
0 commit comments