-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Allow invalid limits when panning #9363
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
Allow invalid limits when panning #9363
Conversation
I would be happy to try this, alone I cannot find any instructions how to get this change into the maplotlib git repo I just downloaded for 30 min. I am sure it is easy to do, but I cannot guess how to. There no git has provided, etc. If it is even in the git main repo ... sorry, I just have never used this. |
I managed to get you changes on top of current master. No improvement. I firmly believe all "upgrades" on this should just be undone until this can get under control. Here the error message I get from my code which is too long to share:
|
The other problem is that I have a user-created axis that does not plot at all in mpl 2.1, and there is not even an error message. I believe this is due to some silencing of error messages that was also done in 2.1 for the sake of, aka |
OK, I could find the reason for one of the issues, the behaviour of of ax.transData has changed from 2.0.2 to 2.1. If y-axis is log and a y-value of 0 is provided, it returns np.nan also for the x-value. This is a bug and should be fixed. Probably a separate bug report should be filed? |
lib/matplotlib/axes/_base.py
Outdated
return converted_limit | ||
def _set_lim(self, axis, low, high, low_name, high_name, | ||
target_obj, target_attr, emit, auto, kw): | ||
"""Helper factoring the functionality of `get_{x,y,z}lim`.""" |
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.
This is a private method, but I still think it would be good to write quick one line descriptions of all the args.
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.
done
lib/matplotlib/axes/_base.py
Outdated
"""Helper factoring the functionality of `get_{x,y,z}lim`.""" | ||
# Perhaps we can use axis.{get,set}_view_interval()... but zaxis seems | ||
# to behave differently. | ||
_called_from_pan = kw.pop("_called_from_pan", False) |
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.
It would be clearer to just add called_from_pan
as it's own kwarg with a default given it's the only kwarg, then the next two lines aren't needed to check for extra kwargs.
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.
Actually I decided to just do the check from the drag_pan function rather than trying to pass it as a private kwarg throught the stack...
9a7a247
to
05e383a
Compare
The latest version actually works better than the pre-broken version: it doesn't even bother passing invalid values to |
I like the direction this is going 👍 |
05e383a
to
b848e8a
Compare
Turns out the set_?lim unification is a mess, because custom axes typically don't define get_${axisname}lim so you need to chase them down to see who's using what name. |
Was the change to ban calling set_?lim with NaNs intentional? That's creating new challenges for us with real-world, real-time messy data. I've got a script that worked in 2.0 that now fails with 2.1 when we calculate limits from data that's all missing. |
The issue was discussed (with a quick vote...) on #7460. I don't think the previous behavior was particularly helpful, but feel free to revisit it... |
Thanks for pointing me to that...looks like I need to fix things on our end. |
Independent of if we should treat |
Backport PR #9363 on branch v2.1.x
PR Summary
Fixes #9361. @2sn please give it a try?
The "culprit" was #8474... this PR adds an escape hatch.
PR Checklist