{{ message }}
Standardize edge-on axis locations when viewing primary 3d axis planes - #23644
Merged
Conversation
scottshambaugh
force-pushed
the
3d_view_axes_alignmnet
branch
from
August 17, 2022 05:15
ca1af31 to
7e5c070
Compare
scottshambaugh
marked this pull request as ready for review
August 17, 2022 05:17
scottshambaugh
force-pushed
the
3d_view_axes_alignmnet
branch
2 times, most recently
from
August 17, 2022 05:32
e34be8a to
7fc0b7d
Compare
Member
Contributor
Author
|
I had thought about that and thought it might be less useful when the axes are shifted away from 0, but am open to that too. Either is an improvement over the current. |
scottshambaugh
marked this pull request as draft
August 17, 2022 18:20
Tests Fix broken tests Clean up test
scottshambaugh
force-pushed
the
3d_view_axes_alignmnet
branch
from
August 18, 2022 00:17
7fc0b7d to
14bd014
Compare
Contributor
Author
|
@QuLogic trying it out, I like the layout of your suggestion just as much and it probably makes more intuitive sense. Simplifies the logic too. I replaced the image in the top post so you can look at it |
Contributor
Author
|
Just for fun, here's an "unfolded" view of a 3D plot that might be useful to people/worth sticking in docs. import matplotlib.pyplot as plt
def annotate_axes(ax, text, fontsize=18):
ax.text(x=0.5, y=0.5, z=0.5, s=text,
va="center", ha="center", fontsize=fontsize, color="black")
# (view, (elev, azim, roll))
views = [( 'XY', ( 90, -90, 0)),
( 'XZ', ( 0, -90, 0)),
( 'YZ', ( 0, 0, 0)),
('-XY', (-90, 90, 0)),
('-XZ', ( 0, 90, 0)),
('-YZ', ( 0, 180, 0))]
layout = [['XY', '.', 'L', '.'],
['XZ','YZ','-XZ','-YZ',],
['.', '.','-XY', '.',]]
fig, axd = plt.subplot_mosaic(layout, subplot_kw={'projection': '3d'})
for i in range(len(axd) - 1):
plane = views[i][0]
axd[plane].set_xlabel('x')
axd[plane].set_ylabel('y')
axd[plane].set_zlabel('z')
axd[plane].set_proj_type('ortho')
axd[plane].view_init(elev=views[i][1][0], azim=views[i][1][1], roll=views[i][1][2])
label = f'{plane}\n{views[i][1]}'
annotate_axes(axd[plane], label, fontsize=14)
label = 'matplotlib Axes3D Primary View Planes\nax.view_init(elev, azim, roll)'
annotate_axes(axd['L'], label, fontsize=18)
axd['L'].set_axis_off()
plt.tight_layout() |
scottshambaugh
marked this pull request as ready for review
August 18, 2022 01:29
Member
|
OK, sorry one more question; can the third Axis also always appear around 0/0? |
Contributor
Author
scottshambaugh
commented
Aug 18, 2022
oscargus
approved these changes
Aug 18, 2022
QuLogic
reviewed
Aug 18, 2022
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
scottshambaugh
commented
Aug 19, 2022
QuLogic
approved these changes
Aug 19, 2022
2 tasks
2 tasks
imgbot Bot
pushed a commit
to kkipngenokoech/matplotlib
that referenced
this pull request
Apr 19, 2026
matplotlib#23644) * Put edge-on axes on left and right when viewing 3d axis planes Tests Fix broken tests Clean up test Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
imgbot Bot
pushed a commit
to kkipngenokoech/matplotlib
that referenced
this pull request
Apr 19, 2026
matplotlib#23644) * Put edge-on axes on left and right when viewing 3d axis planes Tests Fix broken tests Clean up test Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



PR Summary
For the special cases of looking at the 3d axes in the 6 primary view planes (defined in the docs in #23600), draw the axes such that one is on the bottom edge and the other intersects at the low value (ie the intersection is at the origin for these examples). This blends smoothly when rotating the axes manually, since we are only looking at the epsilon case.
Code to generate these plots is the same as here.
Before:

After:

PR Checklist
Tests and Styling
pytestpasses).flake8-docstringsand runflake8 --docstring-convention=all).Documentation
doc/users/next_whats_new/(follow instructions in README.rst there).doc/api/next_api_changes/(follow instructions in README.rst there).