Skip to content
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

Fixed xlim issue when clearing shared axes #28101

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1233,6 +1233,8 @@ def sharex(self, other):
x0, x1 = other.get_xlim()
self.set_xlim(x0, x1, emit=False, auto=other.get_autoscalex_on())
self.xaxis._scale = other.xaxis._scale
other._shared_axes["x"].join(other, self)
other._sharex = self

def sharey(self, other):
"""
Expand All @@ -1252,6 +1254,8 @@ def sharey(self, other):
y0, y1 = other.get_ylim()
self.set_ylim(y0, y1, emit=False, auto=other.get_autoscaley_on())
self.yaxis._scale = other.yaxis._scale
other._shared_axes["y"].join(other, self)
other._sharey = self

def __clear(self):
"""Clear the Axes."""
Expand Down Expand Up @@ -1370,6 +1374,7 @@ def __clear(self):
share = getattr(self, f"_share{name}")
if share is not None:
getattr(self, f"share{name}")(share)
axis.set_inverted(False)
else:
# Although the scale was set to linear as part of clear,
# polar requires that _set_scale is called again
Expand Down