Skip to content

Backport PR #19709 on branch v3.4.x (Fix arrow_guide.py typo) #19711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions examples/shapes_and_collections/arrow_guide.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
that behave differently when the data limits on a plot are changed. In general,
points on a plot can either be fixed in "data space" or "display space".
Something plotted in data space moves when the data limits are altered - an
example would the points in a scatter plot. Something plotted in display space
stays static when data limits are altered - an example would be a figure title
or the axis labels.
example would be the points in a scatter plot. Something plotted in display
space stays static when data limits are altered - an example would be a
figure title or the axis labels.

Arrows consist of a head (and possibly a tail) and a stem drawn between a
start point and end point, called 'anchor points' from now on.
Expand Down Expand Up @@ -39,10 +39,9 @@
# -----------------------------------------------------------------------
#
# This is useful if you are annotating a plot, and don't want the arrow to
# to change shape or position if you pan or scale the plot. Note that when
# the axis limits change
# to change shape or position if you pan or scale the plot.
#
# In this case we use `.patches.FancyArrowPatch`
# In this case we use `.patches.FancyArrowPatch`.
#
# Note that when the axis limits are changed, the arrow shape stays the same,
# but the anchor points move.
Expand All @@ -63,14 +62,14 @@
# ---------------------------------------------------
#
# This is useful if you are annotating a plot, and don't want the arrow to
# to change shape or position if you pan or scale the plot.
# change shape or position if you pan or scale the plot.
#
# In this case we use `.patches.FancyArrowPatch`, and pass the keyword argument
# ``transform=ax.transAxes`` where ``ax`` is the axes we are adding the patch
# to.
#
# Note that when the axis limits are changed, the arrow shape and location
# stays the same.
# stay the same.

fig, axs = plt.subplots(nrows=2)
arrow = mpatches.FancyArrowPatch((x_tail, y_tail), (dx, dy),
Expand All @@ -90,10 +89,10 @@
# Head shape and anchor points fixed in data space
# ------------------------------------------------
#
# In this case we use `.patches.Arrow`
# In this case we use `.patches.Arrow`.
#
# Note that when the axis limits are changed, the arrow shape and location
# changes.
# change.

fig, axs = plt.subplots(nrows=2)

Expand Down