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 arrowprops.
Parameters:
text: str
The text of the annotation.
xy: (float, float)
The point (x, y) to annotate. The coordinate system is determined by xycoords.
xytext: (float, float), default: xy
The position (x, y) to place the text at. The coordinate system is determined by textcoords.
xycoords: single or two-tuple of str or Artist or Transform or callable, default: ‘data’
The coordinate system that xy is given in. The following types of values are supported:
One of the following strings: Value Description ‘figure points’ Points from the lower left of the figure ‘figure pixels’ Pixels from the lower left of the figure ‘figure fraction’ Fraction of figure from lower left ‘subfigure points’ Points from the lower left of the subfigure ‘subfigure pixels’ Pixels from the lower left of the subfigure ‘subfigure fraction’ Fraction of subfigure from lower left ‘axes points’ Points from lower left corner of the Axes ‘axes pixels’ Pixels from lower left corner of the Axes ‘axes fraction’ Fraction of Axes from lower left ‘data’ Use the coordinate system of the object being annotated (default) ‘polar’ (theta, r) if not native ‘data’ coordinates Note that ‘subfigure pixels’ and ‘figure pixels’ are the same for the parent figure, so users who want code that is usable in a subfigure can use ‘subfigure pixels’.
An Artist: xy is interpreted as a fraction of the artist’s Bbox. E.g. (0, 0) would be the lower left corner of the bounding box and (0.5, 1) would be the center top of the bounding box.
A Transform to transform xy to screen coordinates.
A function with one of the following signatures: where renderer is a RendererBase subclass. The result of the function is interpreted like the Artist and Transform cases above.
The exact starting point position of the arrow is defined by relpos. It’s a tuple of relative coordinates of the text box, where (0, 0) is the lower left corner and (1, 1) is the upper right corner. Values <0 and >1 are supported and specify points outside the text box. By default (0.5, 0.5), so the starting point is centered in the text box.
annotation_clip: bool or None, default: None
Whether to clip (i.e. not draw) the annotation when the annotation point xy is outside the Axes area.
If True, the annotation will be clipped when xy is outside the Axes.
If False, the annotation will always be drawn.
If None, the annotation will be clipped when xy is outside the Axes and xycoords is ‘data’.
﹡﹡kwargs
Additional kwargs are passed to Text.
Returns:
✤ Annotation
See also:
Annotations
Notes:
Note: This is the pyplot wrapper for axes.Axes.annotate.