Skip to content

Autoscale for ax.arrow()#13788

Closed
liujordan wants to merge 1 commit into
matplotlib:masterfrom
liujordan:master
Closed

Autoscale for ax.arrow()#13788
liujordan wants to merge 1 commit into
matplotlib:masterfrom
liujordan:master

Conversation

@liujordan

@liujordan liujordan commented Mar 29, 2019

Copy link
Copy Markdown

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
Copy Markdown
Member

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

@dstansby dstansby left a comment

Copy link
Copy Markdown
Member

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?

@jklymak jklymak added this to the v3.2.0 milestone Aug 14, 2019
@jklymak jklymak added the API: consistency Consistency of the matplotlib API, including naming, behavior, defaults, … label Aug 14, 2019
@teto

teto commented Sep 1, 2019

Copy link
Copy Markdown

Looking forward to this fix ! thanks

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

Copy link
Copy Markdown
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

teto commented Sep 26, 2019

Copy link
Copy Markdown

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

@choyiny

choyiny commented Sep 27, 2019

Copy link
Copy Markdown
Contributor

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

@choyiny

choyiny commented Oct 1, 2019

Copy link
Copy Markdown
Contributor

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

@anntzer anntzer left a comment

Copy link
Copy Markdown
Contributor

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

anntzer commented Oct 1, 2019

Copy link
Copy Markdown
Contributor

Looks like something went wrong with the rebase? :(

@choyiny

choyiny commented Oct 1, 2019

Copy link
Copy Markdown
Contributor

Trying to fix it now.

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

choyiny commented Oct 8, 2019

Copy link
Copy Markdown
Contributor

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

@jklymak

jklymak commented Oct 9, 2019

Copy link
Copy Markdown
Member

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

Labels

API: consistency Consistency of the matplotlib API, including naming, behavior, defaults, … status: duplicate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Autoscale does not work for ax.arrow()

9 participants