Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
dlukes wants to merge1 commit intomatplotlib:main
base:main
Choose a base branch
Loading
fromdlukes:doc/setlim-datalim

Conversation

dlukes
Copy link

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 theAxes.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 theAxes.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

Copy link

@github-actionsgithub-actionsbot left a 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.

@timhoffm
Copy link
Member

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 theset_xlim() API with margin capability.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@github-actionsgithub-actions[bot]github-actions[bot] left review comments

At least 1 approving review is required to merge this pull request.

Assignees
No one assigned
Projects
Status: Waiting for author
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@dlukes@timhoffm@melissawm@rcomer

[8]ページ先頭

©2009-2025 Movatter.jp