Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Hint how to set axis limits with margins#25962
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
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 uson gitter for real-time discussion.
For details on testing, writing docs, and our review process, please seethe developer guide
We strive to be a welcoming and open project. Please follow ourCode of Conduct.
Thanks for the contribution. A textual description in the docstring is quite hard to follow. I think there are two alternatives: Likely the right one: Create an example. Maybe (but likely not - that would need more thorough thought and discussion): Expand the |
PR summary
I recently came across a use case where I wanted to manually tweak axis limits, but also apply the margins which are added when autoscaling. It took me a while to figure out how to do this in an elegant way that would avoid computing the margins manually (in order to defer to Matplotlib for this): by modifying the
Axes.dataLim
bounding box and re-applying autoscaling. SinceAxes.set_{x,y}lim
is the most straightforward starting point when considering axis limits tweaks, I think it would make sense to document this approach there, as a helpful hint to anyone trying to do something similar.I understand this might not be wanted for a variety of reasons, or perhaps you'd rather put this somewhere else than in the API docs for the
Axes.set_{x,y}lim
functions, or perhaps you'd just phrase it differently. I just wanted to start the conversation over a concrete suggestion; that's why a PR instead of just opening an issue. I do think that it would be useful to document this somewhere, preferably in a way that's reachable from theAxes.set_{x,y}lim
docs, but I'm not too particular about the details and would be happy to take suggestions about places which might be a better fit.PR checklist