Skip to content

[Bug]: Should Axes.set_xlim(..., emit=False) really not sync shared axes? #26085

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
anntzer opened this issue Jun 7, 2023 · 0 comments
Open

Comments

@anntzer
Copy link
Contributor

anntzer commented Jun 7, 2023

Bug summary

Currently, calling ax.set_xlim(..., emit=False) explicitly does not sync the xlims to other axes that are sharex with ax (i.e. the other axes keep their previous limits). This isn't really an accident of implementation, but is rather explicitly implemented at the bottom of Axis._set_lim.

However, this leads to buggy behavior, e.g. tick locators, which are shared between sharex axes, mis-handled being simultaneously assigned to two axes with different limits.

Code for reproduction

fig, axs = subplots(1, 2, sharex=True); axs[0].set_xlim((0, .1), emit=False)

Actual outcome

test
Note the nonsensical ticks on the second axis, which still have limits of (0, 1) but uses a tick locator which thinks the limits are (0, 0.1).

Expected outcome

Probably syncing with sharex axes should always be done, even when emit=False.

Additional information

No response

Operating system

No response

Matplotlib Version

3.8.0.dev1236+gfc350ea534

Matplotlib Backend

any

Python version

3.11

Jupyter version

No response

Installation

git checkout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant