-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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
Conversation
Does this still work for plot? Ie can you add the same test for plot? |
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). |
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. |
This does not seem to fix the Could we do this test via the |
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. |
There was a problem hiding this 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.
Thanks for tracking down fill_between and making the test a bit nicer by using |
@@ -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, |
There was a problem hiding this comment.
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.
Awesome! |
…781-on-v3.3.x Backport PR #17781 on branch v3.3.x (Fix limit setting after plotting empty data)
Fixes #17586
This was a fun one to track down... It boiled down to plotting
[], []
updating the datalims with[-inf, inf]
, which then setignore_existing_data_limits
toFalse
. Having non-finite limits means thatignore_existing_data_limits
shouldn't be set toFalse
though, so now check that the limits are finite.