Hint how to set axis limits with margins#25962
Hint how to set axis limits with margins#25962dlukes wants to merge 1 commit intomatplotlib:mainfrom
Conversation
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.
|
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 |
|
This one has stalled for some time, so let's close it. An example can always be added in a new PR. |
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.dataLimbounding box and re-applying autoscaling. SinceAxes.set_{x,y}limis 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}limfunctions, 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}limdocs, 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