Skip to content
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

Merged
merged 2 commits into from Jul 26, 2019
Merged

Fix nightly test errors #14891

merged 2 commits into from Jul 26, 2019

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Jul 26, 2019

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

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • [N/A] New features are documented, with examples if plot related
  • [N/A] Documentation is sphinx and numpydoc compliant
  • [N/A] Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • [N/A] Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

NumPy 1.18.x will not like setting an array slice with a ragged array
like this.
@tacaswell tacaswell added this to the v3.2.0 milestone Jul 26, 2019
@@ -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]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
edge_size = max(np.diff(xlim), np.diff(ylim))[0]
edge_size, = max(np.diff(xlim), np.diff(ylim))

Will that work instead?

Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.

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.

Have one minor suggestion, ok either way.

@jklymak
Copy link
Member

jklymak commented Jul 26, 2019

Merging as numpy report has gone in...

@jklymak jklymak merged commit 9baab69 into matplotlib:master Jul 26, 2019
@QuLogic QuLogic deleted the fix-nightly branch July 26, 2019 19:41
jschueller added a commit to jschueller/matplotlib-feedstock that referenced this pull request Nov 4, 2019
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants