| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
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.
Sorry, something went wrong.
|
Thanks! The failure comes from a test that tests that equal is not supported... 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 aspect='equal'. For example, something similar to the one that you have. 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. |
Sorry, something went wrong.
|
Hi @oscargus, |
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
|
I agree with you. Concerning the test, I will try to finalize it next week. |
Sorry, something went wrong.
| 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.
| 'equal' automatic; adapt the axes to have equal aspect | |
| 'equal' automatic; adapt the axes to have equal aspect. |
Sorry, something went wrong.
| mpl_toolkits.mplot3d.axes3d.Axes3D.set_box_aspect | ||
| """ | ||
| if aspect != 'auto': | ||
| if aspect not in ['auto', 'equal']: |
There was a problem hiding this comment.
| if aspect not in ['auto', 'equal']: | |
| if aspect not in ('auto', 'equal'): |
Minor thing, but slightly faster this way as this can be "compiled".
Sorry, something went wrong.
|
Approved subject to minor fixes and rebasing/squashing into single commit. |
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
|
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 git commit --amend so that the change will stay in that single commit. |
Sorry, something went wrong.
|
We can also squash the commits when merging. |
Sorry, something went wrong.
|
Hi @oscargus , |
Sorry, something went wrong.
|
I think that may not have worked, but do not worry, we can sort it out while merging. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR Summary
Closes #22570
Make axis('equal') available
(I am new in PR - sorry for not doing things correctly)
PR Checklist
Tests and Styling
Documentation
Example
import numpy as np import matplotlib.pyplot as plt def plot_hexahedron(ax, x, y, z, *args, **kwargs): def plot_edge(i, j): ax.plot([x[i], x[j]], [y[i], y[j]], [z[i], z[j]], *args, **kwargs) # edges associated to the y=0 face plot_edge(0, 1) plot_edge(1, 3) plot_edge(3, 2) plot_edge(2, 0) # edges associated to the y=1 face plot_edge(4, 5) plot_edge(5, 7) plot_edge(7, 6) plot_edge(6, 4) # missing edges (x=cste) plot_edge(0, 4) plot_edge(1, 5) plot_edge(3, 7) plot_edge(2, 6) def ex_hexahedron(): """ Example of hexahedron representation with Matplotlib """ points = np.array([[0, 0, 0], [1, 0, 0], [0, 1, 0], [1, 1, 0], [0, 0, 3], [1, 0, 3], [0, 1, 3], [1, 1, 3]]) x = np.asarray([coord[0] for coord in points]) y = np.asarray([coord[1] for coord in points]) z = np.asarray([coord[2] for coord in points]) fig, axes = plt.subplots(1, 2, figsize=(12, 5), subplot_kw={'projection': '3d'}) def plot(ax): plot_hexahedron(ax, x, y, z, 'r') ax.set_xlabel("X") ax.set_ylabel("Y") ax.set_zlabel("Z") # standard representation (aspect='auto') plot(axes[0]) axes[0].set_title("Standard representation") # 3d axis equal (aspect='equal') plot(axes[1]) axes[1].set_aspect('equal') axes[1].set_title("set_aspect('equal)") plt.tight_layout() ex_hexahedron() plt.show()