-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Update secondary_axis tutorial #29073
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
Update secondary_axis tutorial #29073
Conversation
…rom the first. In this case the interpolation must be defined outside the bounds of the data that is plotted. Moreover the tutorial in question has been simplified.
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.
make endpoints large in magnitude Co-authored-by: Jody Klymak <[email protected]>
Friendly bump @jklymak |
secax = ax.secondary_xaxis('top', functions=(forward, inverse)) | ||
secax.xaxis.set_minor_locator(AutoMinorLocator()) | ||
secax.set_xlabel('$X_{other}$') | ||
secax.set_xticks([10, 20, 40, 60, 80, 100]) |
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.
Optional: One could consider using the square numbers to make the relation even more obvious
secax.set_xticks([10, 20, 40, 60, 80, 100]) | |
secax.set_xticks([4, 16, 36, 64, 100]) |
On the downside, this is proably slightly less "realistic", i.e. you would likely not find such tick positions in actual diagrams. Choose yourself, what you think is best.
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.
I might prefer the way it is now? Just since it (maybe) more closely corresponds to what you'd have in a real plot
explicitly label x2 = x1**2 Co-authored-by: Tim Hoffmann <[email protected]>
simplify interpolation Co-authored-by: Tim Hoffmann <[email protected]>
Kill unhelpful comment Co-authored-by: Jody Klymak <[email protected]>
…073-on-v3.10.x Backport PR #29073 on branch v3.10.x (Update secondary_axis tutorial)
PR summary
Closes #29067
Fixes a small issue with the secondary_axis tutorial where the interpolation from one axis to the other needs to be defined outside the bounds of the data that is plotted. This was previously noted in the tutorial but was not implemented correctly. The example in question has been simplified and updated so that the secondary axis is correctly derived from the primary axis.
PR checklist