|
9 | 9 | that behave differently when the data limits on a plot are changed. In general,
|
10 | 10 | points on a plot can either be fixed in "data space" or "display space".
|
11 | 11 | Something plotted in data space moves when the data limits are altered - an
|
12 |
| -example would the points in a scatter plot. Something plotted in display space |
13 |
| -stays static when data limits are altered - an example would be a figure title |
14 |
| -or the axis labels. |
| 12 | +example would be the points in a scatter plot. Something plotted in display |
| 13 | +space stays static when data limits are altered - an example would be a |
| 14 | +figure title or the axis labels. |
15 | 15 |
|
16 | 16 | Arrows consist of a head (and possibly a tail) and a stem drawn between a
|
17 | 17 | start point and end point, called 'anchor points' from now on.
|
|
39 | 39 | # -----------------------------------------------------------------------
|
40 | 40 | #
|
41 | 41 | # This is useful if you are annotating a plot, and don't want the arrow to
|
42 |
| -# to change shape or position if you pan or scale the plot. Note that when |
43 |
| -# the axis limits change |
| 42 | +# to change shape or position if you pan or scale the plot. |
44 | 43 | #
|
45 |
| -# In this case we use `.patches.FancyArrowPatch` |
| 44 | +# In this case we use `.patches.FancyArrowPatch`. |
46 | 45 | #
|
47 | 46 | # Note that when the axis limits are changed, the arrow shape stays the same,
|
48 | 47 | # but the anchor points move.
|
|
63 | 62 | # ---------------------------------------------------
|
64 | 63 | #
|
65 | 64 | # This is useful if you are annotating a plot, and don't want the arrow to
|
66 |
| -# to change shape or position if you pan or scale the plot. |
| 65 | +# change shape or position if you pan or scale the plot. |
67 | 66 | #
|
68 | 67 | # In this case we use `.patches.FancyArrowPatch`, and pass the keyword argument
|
69 | 68 | # ``transform=ax.transAxes`` where ``ax`` is the axes we are adding the patch
|
70 | 69 | # to.
|
71 | 70 | #
|
72 | 71 | # Note that when the axis limits are changed, the arrow shape and location
|
73 |
| -# stays the same. |
| 72 | +# stay the same. |
74 | 73 |
|
75 | 74 | fig, axs = plt.subplots(nrows=2)
|
76 | 75 | arrow = mpatches.FancyArrowPatch((x_tail, y_tail), (dx, dy),
|
|
90 | 89 | # Head shape and anchor points fixed in data space
|
91 | 90 | # ------------------------------------------------
|
92 | 91 | #
|
93 |
| -# In this case we use `.patches.Arrow` |
| 92 | +# In this case we use `.patches.Arrow`. |
94 | 93 | #
|
95 | 94 | # Note that when the axis limits are changed, the arrow shape and location
|
96 |
| -# changes. |
| 95 | +# change. |
97 | 96 |
|
98 | 97 | fig, axs = plt.subplots(nrows=2)
|
99 | 98 |
|
|
0 commit comments