Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add Axis.get_inverted and Axis.set_inverted. #13330

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
Feb 2, 2019

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jan 31, 2019

See rationale in changelog note (basically, Axes.invert_xaxis is fine
for interactive use, but a bit of a pain for library-work).

Note that xaxis_inverted is now implemented in terms of get_inverted and
invert_xaxis in terms of set_inverted, so the new methods are properly
tested.

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

See rationale in changelog note (basically, Axes.invert_xaxis is fine
for interactive use, but a bit of a pain for library-work).

Note that xaxis_inverted is now implemented in terms of get_inverted and
invert_xaxis in terms of set_inverted, so the new methods are properly
tested.
@tacaswell tacaswell added this to the v3.1 milestone Feb 1, 2019
Copy link
Member

@jklymak jklymak left a comment

Choose a reason for hiding this comment

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

I'm concerned about where we are storing the state of the axis. This moves more state into Axis, but the real home isAxes; the Axis is a slave of that takes care of implimenting the state of the Axes, and indeed all that Axis.get_view_interval() does is querry Axes.viewLim.intervalx. So I'm against setting the view interval here (though that already exists) and I'm against setting whether that interval is inverted or not here. I think this should all be done at the Axes level...

@anntzer
Copy link
Contributor Author

anntzer commented Feb 1, 2019

The Axis and Axes classes are obviously tightly coupled, but in my view, methods that logically act on a single Axis should, actually, be implemented as Axis methods, not as pairs of Axes methods. If it was up to me, we'd have ax.xaxis.set_lim() and ax.yaxis.set_lim(), not ax.set_xlim and ax.set_ylim (because this avoids having to further add ax.set_rlim, ax.set_thetalim for polar axes, ax.set_zlim for 3d axes, etc.; even though they are just trivial wrappers). (Obviously the ship has sailed for set_lim.)

@jklymak
Copy link
Member

jklymak commented Feb 2, 2019

I guess axis.set_view_interval already exists despite the fact all it does is set the viewelims on the axes 🙄 , so this is fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants