-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Raise errors on invalid axis limits #8216
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
lib/mpl_toolkits/mplot3d/axes3d.py
Outdated
@@ -602,6 +602,10 @@ def set_xlim3d(self, left=None, right=None, emit=True, auto=False, **kw): | |||
if right is None and cbook.iterable(left): | |||
left, right = left | |||
|
|||
if ((np.isscalar(left)) and not (np.isfinite(left))) \ |
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.
Don't need the trailing \
, enclosing in ()
does the job.
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
@@ -2873,6 +2873,11 @@ def set_xlim(self, left=None, right=None, emit=True, auto=False, **kw): | |||
left, right = left | |||
|
|||
self._process_unit_info(xdata=(left, right)) | |||
|
|||
if ((np.isscalar(left)) and not (np.isfinite(left))) \ |
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 should probably go after converting the units.
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
github-foo linkage: #7460 |
#7744 fixed the bug. Can this PR be re-based and sort out if the tests should be expanded? |
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.
Need to sort out if tests are redundant, code changes are redundant.
I've just changed the title to make it more descriptive; it's much more useful to have a short description in the title than just the bug number. It also looks like there's some PEP8 errors - you can see them by clicking on the travis link below. |
FYI, those last three commits have some odd emails for the author/committer. |
Do we still need this PR now that #7744 has been merged? I think the tests are more through from this one? |
I think #8022 might cover even more tests. |
Raise error when xlim is set to nan or inf, same with both set_xlim, set_ylim, set_xlim3d, set_ylim3d, set_zlim3d.
Tests are included too
Fixes #7460