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

FIX: logic of title repositioning#21398

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

Merged
greglucas merged 1 commit intomatplotlib:mainfromjklymak:fix-title-move-logic
Nov 23, 2021

Conversation

jklymak
Copy link
Member

PR Summary

Addresses#21394 so that the padding is consistent, if not exactly what the user wants.

fig, axs = plt.subplots(2, 1, sharex=sharex)axs[0].set_title(f'A sharex={sharex}', pad=-40)axs[1].set_title('B', pad=-40)

Old

Note how when we sharex the title is displaced downwards, but only in the first plot, not the last one. This is inconsistent with the sharex=False behaviour, which is to manually move the axes outside the axes bounds (regardless of the users' pad argument).

We did discuss this behaviour, and decided it was OK, if less than great. Users can get around this by specifyingy manually (i.e.y=1.0001 works fine). We probably should deprecate thepad argument in favour of just asking folks to specify the title position usingy.

Old_sharex_False

Old_sharex_True

New

New_sharex_False
New_sharex_True

PR Checklist

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (runflake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • Conforms to Matplotlib style conventions (installflake8-docstrings and runflake8 --docstring-convention=all).
  • New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).

@tacaswell
Copy link
Member

This PR is affected by a re-writing of our history to remove a large number of accidentally committed filessee discourse for details.

To recover this PR it will need be rebased onto the new default branch (main). There are several ways to accomplish this, but we recommend (assuming that you call the matplotlib/matplotlib remote"upstream"

git remote updategit checkout maingit merge --ff-only upstream/maingit checkout YOUR_BRANCHgit rebase --onto=main upstream/old_master# git rebase -i main # if you prefergit push --force-with-lease# assuming you are tracking your branch

If you do not feel comfortable doing this or need any help please reach out to any of the Matplotlib developers. We can either help you with the process or do it for you.

Thank you for your contributions to Matplotlib and sorry for the inconvenience.

@jklymak
Copy link
MemberAuthor

... rebased

@jklymakjklymak linked an issueOct 21, 2021 that may beclosed by this pull request
Copy link
Member

@dstansbydstansby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Should get an API/behaviour change not, but looks 👍

@dstansbydstansby added this to thev3.6.0 milestoneOct 24, 2021
Copy link
Member

@timhoffmtimhoffm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'm undecided if this really needs an API change note. IMHO pure bugfixes don't need if the original behavior is obviously wrong and nobody will depend on it.

Copy link
Contributor

@greglucasgreglucas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think this is good to go and was not changing expected behavior as evidenced by the linked bug report.

@greglucasgreglucas merged commit6b84f24 intomatplotlib:mainNov 23, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@dstansbydstansbydstansby left review comments

@timhoffmtimhoffmtimhoffm approved these changes

@greglucasgreglucasgreglucas approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v3.6.0
Development

Successfully merging this pull request may close these issues.

[Bug]: Subplot title does not obey padding
5 participants
@jklymak@tacaswell@timhoffm@dstansby@greglucas

[8]ページ先頭

©2009-2025 Movatter.jp