@@ -1456,19 +1456,10 @@ def _get_xy_transform(self, renderer, s):
1456
1456
1457
1457
def _get_ref_xy (self , renderer ):
1458
1458
"""
1459
- return x, y (in display coordinate ) that is to be used for a reference
1460
- of any offset coordinate
1459
+ Return x, y (in display coordinates ) that is to be used for a reference
1460
+ of any offset coordinate.
1461
1461
"""
1462
- def is_offset (s ):
1463
- return isinstance (s , str ) and s .split ()[0 ] == "offset"
1464
-
1465
- if isinstance (self .xycoords , tuple ):
1466
- if any (map (is_offset , self .xycoords )):
1467
- raise ValueError ("xycoords should not be an offset coordinate" )
1468
- elif is_offset (self .xycoords ):
1469
- raise ValueError ("xycoords should not be an offset coordinate" )
1470
- x , y = self .xy
1471
- return self ._get_xy (renderer , x , y , self .xycoords )
1462
+ return self ._get_xy (renderer , * self .xy , self .xycoords )
1472
1463
1473
1464
# def _get_bbox(self, renderer):
1474
1465
# if hasattr(bbox, "bounds"):
@@ -1796,10 +1787,22 @@ def contains(self, event):
1796
1787
contains = contains or in_patch
1797
1788
return contains , tinfo
1798
1789
1790
+ @property
1791
+ def xycoords (self ):
1792
+ return self ._xycoords
1793
+
1794
+ @xycoords .setter
1795
+ def xycoords (self , xycoords ):
1796
+ def is_offset (s ): return isinstance (s , str ) and s .startswith ("offset" )
1797
+ if (isinstance (xycoords , tuple ) and any (map (is_offset , xycoords ))
1798
+ or is_offset (xycoords )):
1799
+ raise ValueError ("xycoords should not be an offset coordinate" )
1800
+ self ._xycoords = xycoords
1801
+
1799
1802
@property
1800
1803
def xyann (self ):
1801
1804
"""
1802
- The the text position.
1805
+ The text position.
1803
1806
1804
1807
See also *xytext* in `.Annotation`.
1805
1808
"""
@@ -1809,28 +1812,24 @@ def xyann(self):
1809
1812
def xyann (self , xytext ):
1810
1813
self .set_position (xytext )
1811
1814
1812
- @property
1813
- def anncoords (self ):
1814
- """The coordinate system to use for `.Annotation.xyann`."""
1815
- return self ._textcoords
1816
-
1817
- @anncoords .setter
1818
- def anncoords (self , coords ):
1819
- self ._textcoords = coords
1815
+ def get_anncoords (self ):
1816
+ """
1817
+ Return the coordinate system to use for `.Annotation.xyann`.
1820
1818
1821
- get_anncoords = anncoords . fget
1822
- get_anncoords . __doc__ = """
1823
- Return the coordinate system to use for `.Annotation.xyann`.
1819
+ See also *xycoords* in `.Annotation`.
1820
+ """
1821
+ return self . _textcoords
1824
1822
1825
- See also *xycoords* in `.Annotation`.
1826
- """
1823
+ def set_anncoords (self , coords ):
1824
+ """
1825
+ Set the coordinate system to use for `.Annotation.xyann`.
1827
1826
1828
- set_anncoords = anncoords . fset
1829
- set_anncoords . __doc__ = """
1830
- Set the coordinate system to use for `.Annotation.xyann`.
1827
+ See also *xycoords* in `.Annotation`.
1828
+ """
1829
+ self . _textcoords = coords
1831
1830
1832
- See also *xycoords* in `.Annotation`.
1833
- """
1831
+ anncoords = property ( get_anncoords , set_anncoords , doc = """
1832
+ The coordinate system to use for `.Annotation.xyann`. """ )
1834
1833
1835
1834
def set_figure (self , fig ):
1836
1835
if self .arrow_patch is not None :
0 commit comments