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: move twins when moving parents#22817

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

Draft
jklymak wants to merge1 commit intomatplotlib:main
base:main
Choose a base branch
Loading
fromjklymak:fix-moved-twin

Conversation

jklymak
Copy link
Member

PR Summary

Closes#21409,#21413 (which it replaces)

The original complaint was that

importmatplotlib.pyplotaspltfig,ax=plt.subplots()ax.set_position([0.2,0.2,0.5,0.5])ax2=ax.twinx()plt.show()

didn't properly position the twin. This will still be a problem with this PR, however

import matplotlib.pyplot as pltfig, ax = plt.subplots()ax2 = ax.twinx()ax.set_position([0.2,0.2,0.5,0.5])plt.show()

works fine (whereas it did not before). I think this is probably acceptable.

Why we can't make it more flexible is that_make_twin is different forAxesSubplot versusAxes objects.AxesSubplot twins take the SubplotSpec of the sibling, where asAxes twins are "located" with their sibling.

The root of the problem here, in my opinion, is that twins are "siblings" versus children. If the twin was a child, it would just follow its parent around, but that is not how the code base with a Grouper treats them, and hence its not possible to tell which is the parent after the axes have been created.

PR Checklist

Tests and Styling

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (installflake8-docstrings and runflake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • 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).
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).

@anntzer
Copy link
Contributor

Perhaps discuss#21413 (comment) first?

@jklymakjklymak marked this pull request as draftApril 10, 2022 10:24
@jklymak
Copy link
MemberAuthor

Yes, sorry, meant to make this draft....

@matkoniecz
Copy link

Is#21413 (comment) resolved?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

[Bug]: twinx and twiny ignores previous set_position
3 participants
@jklymak@anntzer@matkoniecz

[8]ページ先頭

©2009-2025 Movatter.jp