-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[ENH] : Provide axis('equal') for Axes3D #22570 #22705
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a while, please feel free to ping @matplotlib/developers
or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join us on gitter for real-time discussion.
For details on testing, writing docs, and our review process, please see the developer guide
We strive to be a welcoming and open project. Please follow our Code of Conduct.
Thanks! The failure comes from a test that tests that matplotlib/lib/mpl_toolkits/tests/test_mplot3d.py Lines 24 to 28 in 5971feb
So this should be replaced with some test testing the outcome of setting For the actual implementation, I cannot really say much as I do not know the part of this code very well. One can note that it partly seems to work, but that it may also need some adjustments. For example, the 2.0 value of the x-axis is cropped and it looks like the hexahedron is from 0.5 to 1.5 in y-direction. |
Hi @oscargus, |
It seems like it is the location of the ytick-labels that is off. The -1.0 label is outside of the viewable area and all other are shifted one position. So I guess that the actual box is drawn correctly, but the labels are misplaced. Edit: To clarify, I guess that this problem is not caused by your change, so it seems to be an issue elsewhere. |
I agree with you. Concerning the test, I will try to finalize it next week. |
lib/mpl_toolkits/mplot3d/axes3d.py
Outdated
Possible values: | ||
|
||
========= ================================================== | ||
value description | ||
========= ================================================== | ||
'auto' automatic; fill the position rectangle with data. | ||
'equal' automatic; adapt the axes to have equal aspect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'equal' automatic; adapt the axes to have equal aspect | |
'equal' automatic; adapt the axes to have equal aspect. |
lib/mpl_toolkits/mplot3d/axes3d.py
Outdated
@@ -322,14 +316,27 @@ def set_aspect(self, aspect, adjustable=None, anchor=None, share=False): | |||
-------- | |||
mpl_toolkits.mplot3d.axes3d.Axes3D.set_box_aspect | |||
""" | |||
if aspect != 'auto': | |||
if aspect not in ['auto', 'equal']: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if aspect not in ['auto', 'equal']: | |
if aspect not in ('auto', 'equal'): |
Minor thing, but slightly faster this way as this can be "compiled".
Approved subject to minor fixes and rebasing/squashing into single commit. |
The error comes from adding a figure in one commit and updating in another. If you rebase and squash the commits into a single one, it should go away. |
Oh, you are using the main branch. In general it is better to not do that, but to create a separate branch. Now, you need to do something like Then, for later updates you can do
so that the change will stay in that single commit. |
We can also squash the commits when merging. |
Hi @oscargus , |
I think that may not have worked, but do not worry, we can sort it out while merging. |
PR Summary
Closes #22570
Make axis('equal') available
(I am new in PR - sorry for not doing things correctly)
PR Checklist
Tests and Styling
pytest
passes).flake8-docstrings
and 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).Example