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