Skip to content

DOC: view_init docstring for 3d axes primary view angles #23600

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 11, 2022

Conversation

scottshambaugh
Copy link
Contributor

@scottshambaugh scottshambaugh commented Aug 10, 2022

PR Summary

Adds documentation showing azimuth and elevation angles needed to look at the primary planes in 3d plots. Fulfills some of the needs of #23544, resulting views are in that issue

PR Checklist

Tests and Styling

  • [N/A] Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • [N/A] New features are documented, with examples if plot related.
  • [N/A] New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • [N/A] API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).

@scottshambaugh
Copy link
Contributor Author

Docs build and look good:
image

Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

The naming follows a consistent, but maybe not intuitive pattern:

  • The first letter defines the horizontal axis, values increase from left to right
  • The second letter defines the horizontal axis, values increase from top to bottom

The first one is clear, but top-bottom direction in the vertical may be surprising. All standard 2D and 3D plots in matplitlib use vertically increasing values. The direction is a combined result of the roll=0 constraint and the rotations necessary to get the horizontal and vertical axes positioned.

As long as this is only documentation and not API, it's not overly important because we can change it later.

However, I suggest to consider alternative names AB where A is horizontal axis, increasing left to right, and B is the vertical axis, increasing bottom to top. One can optionally add a - to reverse each axis separately (t.b.d. whether that minus should be before or after the letter, e.g. X-Y- or -X-Y). Depending on the axises and the orientation, this may involve roll or not, but the coordinate system itself would still remain right-handed (well, unless you reverse the axis limits, e.g. set_xlim(1, -1), which you can always do).

@scottshambaugh
Copy link
Contributor Author

scottshambaugh commented Aug 11, 2022

@timhoffm I believe what you're suggesting is currently what happens when you plug in those values? First letter defining a left-right increasing horizontal axis, and second letter defining an increasing bottom-top vertical axis, with the negative sign flipping that adjacent axis. Are you seeing something different?

I like the thought of moving the position of the negative sign(s) to define additional views, though I think it would be too much clutter to list all 24 combinations out.
image

@timhoffm timhoffm added this to the v3.6.0 milestone Aug 11, 2022
@timhoffm timhoffm merged commit 069ab87 into matplotlib:main Aug 11, 2022
@timhoffm
Copy link
Member

@scottshambaugh You are right: the vertical axis is as expected. Thanks for the PR!

My more general comment on the minus signs is mostly relevant in case we want to introduce the naming as API. I agree it's not reasonable to list all possible views in the docstring.

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.

2 participants