-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Merge arrow_simple_demo into arrow_guide. #20386
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
Conversation
axs[1].arrow( | ||
x_tail + 1, y_tail - .4, dx, dy, width=.1, length_includes_head=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I very much dig this example of showing how the patch is identical to the method.
axs[1].add_patch(arrow) | ||
axs[1].arrow( | ||
x_tail + 1, y_tail - .4, dx, dy, width=.1, length_includes_head=True) | ||
axs[1].set(xlim=(0, 2), ylim=(0, 2)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be ymax=2? Seems to be a lot of whitespace in the bottom Axes compared to the top one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's intentional to be consistent with the other figures created by this example and to show the distortion that occurs when drawing arrows in data coords.
arrow = mpatches.FancyArrow( | ||
x_tail, y_tail - .4, dx, dy, width=.1, length_includes_head=True) | ||
axs[0].add_patch(arrow) | ||
axs[0].arrow( | ||
x_tail + 1, y_tail - .4, dx, dy, width=.1, length_includes_head=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe color the arrows differently, so that it's easier to see which code created which arrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better if all have different colors.
8000 | width=.1, length_includes_head=True, color="C1") | |
axs[0].add_patch(arrow) | ||
axs[0].arrow(x_tail + 1, y_tail - .4, dx, dy, | ||
width=.1, length_includes_head=True, color="C1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
width=.1, length_includes_head=True, color="C1") | |
width=.1, length_includes_head=True, color="C2") |
width=.1, length_includes_head=True, color="C1") | ||
axs[1].add_patch(arrow) | ||
axs[1].arrow(x_tail + 1, y_tail - .4, dx, dy, | ||
width=.1, length_includes_head=True, color="C1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
width=.1, length_includes_head=True, color="C1") | |
width=.1, length_includes_head=True, color="C2") |
plt.arrow() (aka patches.FancyArrow) has a rather awkward API and doesn't warrant its own demo, but can be mentioned at the end of the arrow guide together with patches.Arrow, which is nearly as awkward...
sure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anybody can merge after CI pass.
plt.arrow() (aka patches.FancyArrow) has a rather awkward API (#12768) and
doesn't warrant its own demo, but can be mentioned at the end of the
arrow guide together with patches.Arrow, which is nearly as awkward...
PR Summary
PR Checklist
pytest
passes).flake8
on changed files to check).flake8-docstrings
and runflake8 --docstring-convention=all
).doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).