Annotate the point *xy* with text *s*. In the simplest form, the text is placed at *xy*. Optionally, the text can be displayed in another position *xytext*. An arrow pointing from the text to the annotated point *xy* can then be added by defining *arrowprop
(self, s, xy,
xytext=None,
xycoords='data',
textcoords=None,
arrowprops=None,
annotation_clip=None,
**kwargs)
| 1996 | return "Annotation(%g, %g, %r)" % (self.xy[0], self.xy[1], self._text) |
| 1997 | |
| 1998 | def __init__(self, s, xy, |
| 1999 | xytext=None, |
| 2000 | xycoords='data', |
| 2001 | textcoords=None, |
| 2002 | arrowprops=None, |
| 2003 | annotation_clip=None, |
| 2004 | **kwargs): |
| 2005 | """ |
| 2006 | Annotate the point *xy* with text *s*. |
| 2007 | |
| 2008 | In the simplest form, the text is placed at *xy*. |
| 2009 | |
| 2010 | Optionally, the text can be displayed in another position *xytext*. |
| 2011 | An arrow pointing from the text to the annotated point *xy* can then |
| 2012 | be added by defining *arrowprops*. |
| 2013 | |
| 2014 | Parameters |
| 2015 | ---------- |
| 2016 | s : str |
| 2017 | The text of the annotation. |
| 2018 | |
| 2019 | xy : (float, float) |
| 2020 | The point *(x,y)* to annotate. |
| 2021 | |
| 2022 | xytext : (float, float), optional |
| 2023 | The position *(x,y)* to place the text at. |
| 2024 | If *None*, defaults to *xy*. |
| 2025 | |
| 2026 | xycoords : str, `.Artist`, `.Transform`, callable or tuple, optional |
| 2027 | |
| 2028 | The coordinate system that *xy* is given in. The following types |
| 2029 | of values are supported: |
| 2030 | |
| 2031 | - One of the following strings: |
| 2032 | |
| 2033 | ================= ============================================= |
| 2034 | Value Description |
| 2035 | ================= ============================================= |
| 2036 | 'figure points' Points from the lower left of the figure |
| 2037 | 'figure pixels' Pixels from the lower left of the figure |
| 2038 | 'figure fraction' Fraction of figure from lower left |
| 2039 | 'axes points' Points from lower left corner of axes |
| 2040 | 'axes pixels' Pixels from lower left corner of axes |
| 2041 | 'axes fraction' Fraction of axes from lower left |
| 2042 | 'data' Use the coordinate system of the object being |
| 2043 | annotated (default) |
| 2044 | 'polar' *(theta,r)* if not native 'data' coordinates |
| 2045 | ================= ============================================= |
| 2046 | |
| 2047 | - An `.Artist`: *xy* is interpreted as a fraction of the artists |
| 2048 | `~matplotlib.transforms.Bbox`. E.g. *(0, 0)* would be the lower |
| 2049 | left corner of the bounding box and *(0.5, 1)* would be the |
| 2050 | center top of the bounding box. |
| 2051 | |
| 2052 | - A `.Transform` to transform *xy* to screen coordinates. |
| 2053 | |
| 2054 | - A function with one of the following signatures:: |
| 2055 |