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 issue with shared x-axis resetting when calling cla() on shared axes#28697

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

Closed

Conversation

ydotwang
Copy link

@ydotwangydotwang commentedAug 9, 2024
edited
Loading

PR summary

Fix bidirectional axis sharing in sharex, sharey, and __clear methods

Description:
This pull request addresses issues related to the handling of shared axes (sharex and sharey) in Matplotlib, particularly in scenarios involving clearing of axes.

Summary of Changes:
Bidirectional Sharing:
The sharex and sharey methods have been updated to ensure bidirectional sharing of axes. Previously, when axis A shared its x-axis with axis B, changes to B would not affect A. This has been corrected by ensuring that B also shares its x-axis back with A.

Impact:
These changes resolve the issue where shared axes would not behave symmetrically, leading to unexpected behavior when clearing axes or working with inverted axes. The updates ensure consistent and predictable behavior in shared axes scenarios.

Before PR:
image

After PR:
image

Testing:
Existing tests related to shared axes should be reviewed to ensure they cover these scenarios. New tests can be added to specifically verify bidirectional sharing and correct inversion handling during clearing.
This pull request ensures that Matplotlib handles shared axes in a robust manner, improving the overall user experience when working with subplots and synchronized axes.

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 week or so, please leave a new comment below and that should bring it to our attention. 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.

@ydotwangydotwang reopened thisAug 9, 2024
@ydotwangydotwang changed the titleFix issue with shared x-axis resetting when calling cla() on shared axesFix issue with shared x-axis resetting when calling cla() on shared axes Issure with #27825Aug 10, 2024
@ydotwangydotwang changed the titleFix issue with shared x-axis resetting when calling cla() on shared axes Issure with #27825Fix issue with shared x-axis resetting when calling cla() on shared axesAug 10, 2024
@rcomer
Copy link
Member

Thanks for your contribution@ydotwang! Please could you add atest to ensure this behaviour does not break again in future?

@timhoffm
Copy link
Member

This is a dupliate. The approach was suggested in theoriginal issue and the poster already made a PR (#28101). Discussion should continue in that PR.

rcomer reacted with thumbs up emojircomer reacted with eyes emoji

@ydotwang
Copy link
Author

Thanks for your contribution@ydotwang! Please could you add atest to ensure this behaviour does not break again in future?

Hi, I see. I would like to write tests for this! Could you give me some advice?

@timhoffm
Copy link
Member

@ydotwang thanks for the interest. It's currently not possible to write a test. The solution of mutually sharing Axes would solve the concrete issue, however it would introduce other issues. The proper way forward is laid out in#28101 (comment), but it's a non-trivial rearchitecturing. Tests will need to be written in the process of that migration.

@ydotwang
Copy link
Author

@ydotwang thanks for the interest. It's currently not possible to write a test. The solution of mutually sharing Axes would solve the concrete issue, however it would introduce other issues. The proper way forward is laid out in#28101 (comment), but it's a non-trivial rearchitecturing. Tests will need to be written in the process of that migration.

Thank you for your answer!

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

@Oliver-lab-devOliver-lab-devOliver-lab-dev approved these changes

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

Successfully merging this pull request may close these issues.

[Bug]: Axes.cla() with sharex may wrongly reset the axes limit.
4 participants
@ydotwang@rcomer@timhoffm@Oliver-lab-dev

[8]ページ先頭

©2009-2025 Movatter.jp