Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Autoscale for ax.arrow() #13788

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

Closed
wants to merge 1 commit into from
Closed

Conversation

liujordan
Copy link

@liujordan liujordan commented Mar 29, 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 call autoscale_view() after adding it on the axes.

Resolves #12712

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

@ImportanceOfBeingErnest
Copy link
Member

In view of #11350 I'd be interested to know what use case people have for ax.arrow.

Copy link
Member

@dstansby dstansby left a comment

Choose a reason for hiding this comment

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

This looks good to me. For the test, instead of adding a new image (we try and avoid that) could you instead add a manual check that the axes limits change to include the arrow after the axes are autoscaled?

@teto
Copy link

teto commented Sep 1, 2019

Looking forward to this fix ! thanks

@tacaswell tacaswell modified the milestones: v3.2.0, v3.3.0 Sep 5, 2019
@tacaswell
Copy link
Member

This will also need an API change note. There are likely users who are relying on this not auto-scaling and they need to be notified.

@teto
Copy link

teto commented Sep 26, 2019

@liujordan please don't give up ! I want your fix :p

@choyiny
Copy link
Contributor

choyiny commented Sep 27, 2019

Taking over from @liujordan. This was previously a student project at University of Toronto Scarborough with Dr. Anya Tafliovich (@atafliovich).

@choyiny
Copy link
Contributor

choyiny commented Oct 1, 2019

A major change I made was removing the autoscale call. From #13593, autoscale is now lazily applied.

Copy link
Contributor

@anntzer anntzer left a comment

Choose a reason for hiding this comment

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

Please remove the unused image file and squash your commits.

@anntzer
Copy link
Contributor

anntzer commented Oct 1, 2019

Looks like something went wrong with the rebase? :(

@choyiny
Copy link
Contributor

choyiny commented Oct 1, 2019

Trying to fix it now.

@choyiny choyiny mentioned this pull request Oct 8, 2019
6 tasks
@choyiny
Copy link
Contributor

choyiny commented Oct 8, 2019

I was unable to fix this branch, so restarted in another PR #15392

@jklymak
Copy link
Member

jklymak commented Oct 9, 2019

Closing for other pr

@jklymak jklymak closed this Oct 9, 2019
teto added a commit to teto/pymptcpanalyzer that referenced this pull request Oct 25, 2019
can try
mptcpanalyzer -dDEBUG "plot dss examples/client_2_filtered.pcapng 1 --dest=Server" "quit"

There is an issue with autoscaling not working because FancyArrows are
drawn as artists rather than patches see
matplotlib/matplotlib#13788
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.

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