Skip to content

Fix limit setting after plotting empty data #17781

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 5 commits into from
Jun 29, 2020
Merged

Conversation

dstansby
Copy link
Member

@dstansby dstansby commented Jun 27, 2020

Fixes #17586

This was a fun one to track down... It boiled down to plotting [], [] updating the datalims with [-inf, inf], which then set ignore_existing_data_limits to False. Having non-finite limits means that ignore_existing_data_limits shouldn't be set to False though, so now check that the limits are finite.

@jklymak
Copy link
Member

jklymak commented Jun 27, 2020

Does this still work for plot? Ie can you add the same test for plot?

@dstansby
Copy link
Member Author

Seems to work fine with plot, I've updated the test. The limits are slightly different between plot and scatter (I presume because plot doesn't have markers to take into account when autoscaling).

@jklymak
Copy link
Member

jklymak commented Jun 27, 2020

Hmm. Really? We took the marker size logic out of the limits determination. I guess ideally they should be identical but if that’s beyond this PR I understand.

@tacaswell tacaswell added this to the v3.3.0 milestone Jun 28, 2020
@tacaswell
Copy link
Member

This does not seem to fix the fill_between case, do we want to hold for that fix as well or bank this fix and leave #17586 open?

Could we do this test via the check_figures_equal fixture by plotting the empty data on just one of them? That would save us from having to hard-code the expected limits.

@tacaswell
Copy link
Member

I figured out the fill_between issue (thanks for doing the hard work @dstansby !) and now it runs through the same codepath.

Will push a commit with that fix and a change to the tests soon.

Copy link
Member

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

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

I approve, but given that I now have commits on this branch, I don't want to merge it.

@dstansby
Copy link
Member Author

Thanks for tracking down fill_between and making the test a bit nicer by using ax. instead of plt.!

@@ -5291,9 +5291,7 @@ def get_interp_point(idx):
np.column_stack([ind[where], dep2[where]])])
if ind_dir == "y":
pts = pts[:, ::-1]
self.dataLim.update_from_data_xy(pts, self.ignore_existing_data_limits,
Copy link
Member

@jklymak jklymak Jun 28, 2020

Choose a reason for hiding this comment

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

Should this method get a comment that its usually meant to be called by Axes.update_datalim? We need more breadcrumbs for developers so they don't get lost amongst the many levels of redirection....

Ooops scrub that, I see that is a bbox method so general enough that folks shouldn't be looking there for axes-specific methods.

@mwaskom
Copy link

mwaskom commented Jun 29, 2020

Awesome!

@dstansby dstansby deleted the lim-set branch June 29, 2020 21:30
QuLogic added a commit that referenced this pull request Jun 29, 2020
…781-on-v3.3.x

Backport PR #17781 on branch v3.3.x (Fix limit setting after plotting empty data)
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.

Surprising datetime autoscaling after passing empty data
4 participants