8000 Merge arrow_simple_demo into arrow_guide. by anntzer · Pull Request #20386 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
merged 1 commit into from
Jun 10, 2021
Merged

Conversation

anntzer
Copy link
Contributor
@anntzer anntzer commented Jun 8, 2021

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

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

Comment on lines 118 to 119
axs[1].arrow(
x_tail + 1, y_tail - .4, dx, dy, width=.1, length_includes_head=True)
Copy link
Member

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))
Copy link
Member

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.

Copy link
Contributor Author

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.

Comment on lines 107 to 111
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)
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

Copy link
Member
@timhoffm timhoffm left a 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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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...
@anntzer
Copy link
Contributor Author
anntzer commented Jun 9, 2021

sure

Copy link
Member
@timhoffm timhoffm left a 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.

@story645 story645 merged commit d4ac442 into matplotlib:master Jun 10, 2021
@anntzer anntzer deleted the ad branch June 10, 2021 05:16
@QuLogic QuLogic added this to the v3.5.0 milestone Jun 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0