|
18 | 18 | :func:`~matplotlib.axes.Axes.annotate` method provides helper functionality |
19 | 19 | to make annotations easy. In an annotation, there are two points to |
20 | 20 | consider: the location being annotated represented by the argument |
21 | | -``xy`` and the location of the text ``xytext``. Both of these |
| 21 | +*xy* and the location of the text *xytext*. Both of these |
22 | 22 | arguments are ``(x, y)`` tuples. |
23 | 23 |
|
24 | 24 | .. figure:: ../../gallery/pyplots/images/sphx_glr_annotation_basic_001.png |
|
28 | 28 |
|
29 | 29 | Annotation Basic |
30 | 30 |
|
31 | | -In this example, both the ``xy`` (arrow tip) and ``xytext`` locations |
| 31 | +In this example, both the *xy* (arrow tip) and *xytext* locations |
32 | 32 | (text location) are in data coordinates. There are a variety of other |
33 | 33 | coordinate systems one can choose -- you can specify the coordinate |
34 | | -system of ``xy`` and ``xytext`` with one of the following strings for |
35 | | -``xycoords`` and ``textcoords`` (default is 'data') |
| 34 | +system of *xy* and *xytext* with one of the following strings for |
| 35 | +*xycoords* and *textcoords* (default is 'data') |
36 | 36 |
|
37 | 37 | ================== ======================================================== |
38 | 38 | argument coordinate system |
|
60 | 60 |
|
61 | 61 | Optionally, you can enable drawing of an arrow from the text to the annotated |
62 | 62 | point by giving a dictionary of arrow properties in the optional keyword |
63 | | -argument ``arrowprops``. |
| 63 | +argument *arrowprops*. |
64 | 64 |
|
65 | 65 |
|
66 | 66 | ==================== ===================================================== |
67 | | -``arrowprops`` key description |
| 67 | +*arrowprops* key description |
68 | 68 | ==================== ===================================================== |
69 | 69 | width the width of the arrow in points |
70 | 70 | frac the fraction of the arrow length occupied by the head |
|
77 | 77 | ==================== ===================================================== |
78 | 78 |
|
79 | 79 |
|
80 | | -In the example below, the ``xy`` point is in native coordinates |
81 | | -(``xycoords`` defaults to 'data'). For a polar axes, this is in |
| 80 | +In the example below, the *xy* point is in native coordinates |
| 81 | +(*xycoords* defaults to 'data'). For a polar axes, this is in |
82 | 82 | (theta, radius) space. The text in this example is placed in the |
83 | 83 | fractional figure coordinate system. :class:`matplotlib.text.Text` |
84 | | -keyword args like ``horizontalalignment``, ``verticalalignment`` and |
85 | | -``fontsize`` are passed from `~matplotlib.axes.Axes.annotate` to the |
| 84 | +keyword arguments like *horizontalalignment*, *verticalalignment* and |
| 85 | +*fontsize* are passed from `~matplotlib.axes.Axes.annotate` to the |
86 | 86 | ``Text`` instance. |
87 | 87 |
|
88 | 88 | .. figure:: ../../gallery/pyplots/images/sphx_glr_annotation_polar_001.png |
|
120 | 120 |
|
121 | 121 |
|
122 | 122 | The :func:`~matplotlib.pyplot.text` function in the pyplot module (or |
123 | | -`~.axes.Axes.text` method of the Axes class) takes bbox keyword argument, and |
| 123 | +`~.axes.Axes.text` method of the Axes class) takes *bbox* keyword argument, and |
124 | 124 | when given, a box around the text is drawn. :: |
125 | 125 |
|
126 | 126 | bbox_props = dict(boxstyle="rarrow,pad=0.3", fc="cyan", ec="b", lw=2) |
|
184 | 184 | xytext=(x2, y2), textcoords='offset points', |
185 | 185 | ) |
186 | 186 |
|
187 | | -This annotates a point at ``xy`` in the given coordinate (``xycoords``) |
188 | | -with the text at ``xytext`` given in ``textcoords``. Often, the |
| 187 | +This annotates a point at *xy* in the given coordinate (*xycoords*) |
| 188 | +with the text at *xytext* given in *textcoords*. Often, the |
189 | 189 | annotated point is specified in the *data* coordinate and the annotating |
190 | 190 | text in *offset points*. |
191 | 191 | See :func:`~matplotlib.pyplot.annotate` for available coordinate systems. |
192 | 192 |
|
193 | | -An arrow connecting two points (xy & xytext) can be optionally drawn by |
194 | | -specifying the ``arrowprops`` argument. To draw only an arrow, use |
| 193 | +An arrow connecting two points (*xy* & *xytext*) can be optionally drawn by |
| 194 | +specifying the *arrowprops* argument. To draw only an arrow, use |
195 | 195 | empty string as the first argument. :: |
196 | 196 |
|
197 | 197 | ax.annotate("", |
|
444 | 444 | xytext=(0.5, 0.5), textcoords=ax2.transData, |
445 | 445 | arrowprops=dict(arrowstyle="->")) |
446 | 446 |
|
447 | | - 2. :class:`~matplotlib.artist.Artist` instance. The xy value (or |
448 | | - xytext) is interpreted as a fractional coordinate of the bbox |
| 447 | + 2. :class:`~matplotlib.artist.Artist` instance. The *xy* value (or |
| 448 | + *xytext*) is interpreted as a fractional coordinate of the bbox |
449 | 449 | (return value of *get_window_extent*) of the artist. :: |
450 | 450 |
|
451 | 451 | an1 = ax.annotate("Test 1", xy=(0.5, 0.5), xycoords="data", |
|
526 | 526 | axesA=ax1, axesB=ax2) |
527 | 527 | ax2.add_artist(con) |
528 | 528 |
|
529 | | -The above code connects point xy in the data coordinates of ``ax1`` to |
530 | | -point xy in the data coordinates of ``ax2``. Here is a simple example. |
| 529 | +The above code connects point *xy* in the data coordinates of ``ax1`` to |
| 530 | +point *xy* in the data coordinates of ``ax2``. Here is a simple example. |
531 | 531 |
|
532 | 532 | .. figure:: ../../gallery/userdemo/images/sphx_glr_connect_simple01_001.png |
533 | 533 | :target: ../../gallery/userdemo/connect_simple01.html |
|
0 commit comments