Skip to content

More Axis3D cleanup. #14963

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

Merged
merged 1 commit into from
Aug 10, 2019
Merged

More Axis3D cleanup. #14963

merged 1 commit into from
Aug 10, 2019

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Aug 1, 2019

  • Use ndarray.copy instead of copy.copy.
  • "Inline" get_flip_min_max.
  • Vectorize move_from_center.
  • Pass 3-tuples as *xyz instead of xyz[0], xyz[1], xyz[2] to
    maintain them as "single" objects.
  • Convert pep to an array immediately.
  • Use more explicit way to count nonzero elements.

PR Summary

PR Checklist

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

Deprecations
````````````

``axis3d.get_flip_min_max`` is deprecated.
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't this reference need an initial dot?

Copy link
Member

Choose a reason for hiding this comment

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

Oh wait, that's just code style; why not the full path then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added mplot3d in front; as a rule I tend to not put the leading "matplotlib" or "mpl_toolkits" (it's a bit repetitive otherwise).
It's code style because the link is about to be broken.

*centers* by *deltas*.
"""
coord = np.asarray(coord)
return coord + axmask * np.sign(coord - centers) * deltas
Copy link
Member

Choose a reason for hiding this comment

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

This is not exactly the same, but I'm not sure if it's important, as if coord == centers, then np.sign will return 0 and no movement will be made at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fair point, fortunately I can use copysign() to fix that.

- Use ndarray.copy instead of copy.copy.
- "Inline" get_flip_min_max.
- Vectorize move_from_center.
- Pass 3-tuples as `*xyz` instead of `xyz[0], xyz[1], xyz[2]` to
  maintain them as "single" objects.
- Convert `pep` to an array immediately.
- Use more explicit way to count nonzero elements.
@WeatherGod WeatherGod merged commit 39c2264 into matplotlib:master Aug 10, 2019
@anntzer anntzer deleted the axis3d-numpy branch August 10, 2019 14:14
@QuLogic QuLogic added this to the v3.2.0 milestone Aug 11, 2019
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.

4 participants