-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Set transform for offset text in 3d #26185
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 week or so, please leave a new comment below and that should bring it to our attention. 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.
Nice! Since this was basically broken earlier (for a while at least), I'm wondering if one should also adjust the behavior? To me, it seems like the text should maybe not be rotated? A minor thing is that the z-label offset text doesn't look aligned with the label? Maybe there is some inconsistency in rotation anchor? (Which is then primarily a problem if the text is actually rotated, so we should probably decide which is the preferred approach first...) Sorry about the additional questions. This clearly fixes a long standing issue, but since we more or less promise that it will be like this from now on, it is important to get it correct. |
Hi @oscargus, thanks for the advice! Regarding text rotation, the labels and offset text of each axis should align with the direction of the tick labels, instead of the X axis label rotating counterclockwise when the box rotates to the right as shown in the figure , is that correct? For the second question, if
|
I think that we can define ourselves what is correct since it has been broken for so long(?). So it probably a matter of opinion. Looking at the animation it is not so clear what is the preferred behavior. I think that looks quite good with the current approach. The z-alignment issue doesn't seem like a problem in the animation either. I wonder if there is some drawing order problem so that it happens for a single image, but not for an animation? @scottshambaugh any opinions as one of the persons working on the 3D stuff? If nothing else, I'll try to clarify this on the dev-call on Thursday and then we hopefully can reach an agreement what the expected behavior is. (Feel free to join if you want to. Info on https://hackmd.io/Ya6IQSTjSBqJ7TCY6MxUQQ ) |
I implemented the update created by Rylie-W and can confirm that it solves the problem in the code I uploaded and also in the application I am developing. Thanks for the great work Rylie!! |
The test suite sets up a specialized environment for image creation that
tries to be as independent across systems as possible. By running it
outside the test environment, certain things like text won't be quite
correct. This allows us as developers on different systems to be able to
contribute test images regardless of what version of certain libraries and
fonts we have.
…On Wed, Jun 28, 2023 at 10:13 AM Rylie Wei ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In lib/mpl_toolkits/mplot3d/tests/test_axes3d.py
<#26185 (comment)>
:
> + tol=8.816406)
+# the threshold is calculated by binary search
I get the expected image by running the following code and saving the
shown image:
import matplotlib.pyplot as pltimport numpy as np
ax = plt.figure().add_subplot(projection='3d')
X, Y = np.mgrid[0:6*np.pi:0.25, 0:4*np.pi:0.25]Z = np.sqrt(np.abs(np.cos(X) + np.cos(Y)))
ax.plot_surface(X * 1e5, Y * 1e6, Z * 1e8, cmap='autumn',cstride=2, rstride=2)
ax.set_xlabel("X label")ax.set_ylabel("Y label")ax.set_zlabel("Z label")
plt.show()
And note there are position differences between it and the one created by
the unit test. We could set the image created by the test as the expected
one if what we exactly want is to make sure the positioning in future
versions will work the same as it does in this commit.
—
Reply to this email directly, view it on GitHub
<#26185 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACHF6CYETJRD4KU4JKWMSDXNQ3YJANCNFSM6AAAAAAZTDKSKQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Docs an how to rebase: https://matplotlib.org/stable/devel/development_workflow.html#rewriting-commit-history (notes from call) |
Discussed on call. The orientation of the offset texts is a long standing feature so lets take the bug-fix of getting them visible and defer discussion of if the orientation should be changed or not to a later date. |
334f1fd
to
8953596
Compare
Congrats @Rylie-W on your first merged PR, hope to hear from you again! |
PR summary
The PR set the transform for the offset text in 3d and add a unit test for the positioning of labels, offsets and ticks.
PR checklist