Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Bug]: Autoscale not synced between shared axes when interactively zooming #30747

@lukas-lang

Description

@lukas-lang

Bug summary

When creating axes with sharex/sharey turned on and manually zooming into one of them, autoscale_on is not turned off for the other one

Code for reproduction

import matplotlib.pyplot as plt

plt.figure()
ax1 = plt.subplot(1, 2, 1)
ax1.plot([1, 2, 3, 4])
ax2 = plt.subplot(1, 2, 2)
ax2.sharey(ax1)
ax2.plot([4, 3, 2, 1])
plt.show()

# manually zoom the y-axis on either the left or right plot

ax1.autoscale()
ax2.autoscale()
plt.draw()

Actual outcome

The axes are reset, even though autoscale should be disabled in the vertical.

Expected outcome

The axis should not be autoscaled, since I manually zoomed it. If you use ax1.set_ylim(2,3), it disables autoscaling for both y axes, as expected. It's just the interactive zooming that doesn't.

Additional information

No response

Operating system

No response

Matplotlib Version

3.10.6

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions