Skip to content
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

Autoscale for ax.arrow() #15392

Merged
merged 1 commit into from Mar 25, 2020
Merged

Autoscale for ax.arrow() #15392

merged 1 commit into from Mar 25, 2020

Conversation

choyiny
Copy link
Contributor

@choyiny choyiny commented Oct 8, 2019

PR Summary

When ax.arrow() is called, a FancyArrow object is being added to the current axes as an artist and not a patch. So when autoscale_view is called, which loops through all Patches and scales the view based on the minimum and maximum of those, the FancyArrow isn't being considered.
The solution is a two-step process. First, we have to add the arrow as a Patch, and second, we have to lazily call autoscale_view() after adding it on the axes.

Part of a course at University of Toronto with @atafliovich.

Resolves #12712
Takes over #13788

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@choyiny choyiny mentioned this pull request Oct 8, 2019
6 tasks
@choyiny choyiny force-pushed the arrow-autoscale branch 2 times, most recently from 90794e4 to 735996f Compare October 10, 2019 17:13
@choyiny
Copy link
Contributor Author

choyiny commented Oct 10, 2019

Some weird error about test timeout in latest travis build. Force pushing to restart tests.

Copy link
Member

@jklymak jklymak left a comment

Choose a reason for hiding this comment

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

looks right to me

@choyiny
Copy link
Contributor Author

choyiny commented Mar 24, 2020

Not sure what is happening with the tests, but they don't seem to relate to my change.

@timhoffm
Copy link
Member

Sorry for the inconvenience. There was an incorrect merge causing CI to fail (#16897). Can you please rebase on top of master?

@QuLogic
Copy link
Member

QuLogic commented Mar 24, 2020

No need, a close/open should do.

@QuLogic QuLogic closed this Mar 24, 2020
@QuLogic QuLogic reopened this Mar 24, 2020
@QuLogic QuLogic merged commit defce2e into matplotlib:master Mar 25, 2020
@QuLogic QuLogic added this to the v3.3.0 milestone Mar 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Autoscale does not work for ax.arrow()
5 participants