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
Fix nightly test errors #14891
Fix nightly test errors #14891
Conversation
NumPy 1.18.x will not like setting an array slice with a ragged array like this.
@@ -1645,7 +1645,7 @@ def axis(self, *args, emit=True, **kwargs): | |||
self.set_autoscale_on(False) | |||
xlim = self.get_xlim() | |||
ylim = self.get_ylim() | |||
edge_size = max(np.diff(xlim), np.diff(ylim)) | |||
edge_size = max(np.diff(xlim), np.diff(ylim))[0] |
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.
edge_size = max(np.diff(xlim), np.diff(ylim))[0] | |
edge_size, = max(np.diff(xlim), np.diff(ylim)) |
Will that work instead?
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.
And is this a behavior change that is intentional on numpy's part or something we should be reporting back up to them?
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 work, but this is merged now...
I've asked upstream on the PR that introduced the change.
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.
oops, sorry I missed that there was a suggested change in here, and a question.
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.
Have one minor suggestion, ok either way.
Merging as numpy report has gone in... |
Backports matplotlib/matplotlib#14891 Avoids tracebacks such as: File "$PREFIX/lib/python3.8/site-packages/matplotlib/axes/_base.py", line 1694, in axis self.set_xlim([xlim[0], xlim[0] + edge_size], File "$PREFIX/lib/python3.8/site-packages/matplotlib/axes/_base.py", line 3270, in set_xlim left, right = sorted([left, right], reverse=reverse) TypeError: only integer scalar arrays can be converted to a scalar index
PR Summary
This fixes 2 of the 3 test errors on the nightly build. There's still one more error slicing a masked array, but I can't figure out how to reproduce that locally and it seems like a bug in NumPy.
PR Checklist