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

Skip to content

Backport PR #28359 on branch v3.9.x (Document that axes unsharing is impossible.) #28368

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,8 @@ def __init__(self, fig,

sharex, sharey : `~matplotlib.axes.Axes`, optional
The x- or y-`~.matplotlib.axis` is shared with the x- or y-axis in
the input `~.axes.Axes`.
the input `~.axes.Axes`. Note that it is not possible to unshare
axes.

frameon : bool, default: True
Whether the Axes frame is visible.
Expand Down Expand Up @@ -1221,7 +1222,7 @@ def sharex(self, other):

This is equivalent to passing ``sharex=other`` when constructing the
Axes, and cannot be used if the x-axis is already being shared with
another Axes.
another Axes. Note that it is not possible to unshare axes.
"""
_api.check_isinstance(_AxesBase, other=other)
if self._sharex is not None and other is not self._sharex:
Expand All @@ -1240,7 +1241,7 @@ def sharey(self, other):

This is equivalent to passing ``sharey=other`` when constructing the
Axes, and cannot be used if the y-axis is already being shared with
another Axes.
another Axes. Note that it is not possible to unshare axes.
"""
_api.check_isinstance(_AxesBase, other=other)
if self._sharey is not None and other is not self._sharey:
Expand Down
2 changes: 2 additions & 0 deletions lib/matplotlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,8 @@ def subplots(self, nrows=1, ncols=1, *, sharex=False, sharey=False,
When subplots have a shared axis that has units, calling
`.Axis.set_units` will update each axis with the new units.

Note that it is not possible to unshare axes.

squeeze : bool, default: True
- If True, extra dimensions are squeezed out from the returned
array of Axes:
Expand Down
5 changes: 3 additions & 2 deletions lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1639,8 +1639,9 @@ def subplots(
on, use `~matplotlib.axes.Axes.tick_params`.

When subplots have a shared axis that has units, calling
`~matplotlib.axis.Axis.set_units` will update each axis with the
new units.
`.Axis.set_units` will update each axis with the new units.

Note that it is not possible to unshare axes.

squeeze : bool, default: True
- If True, extra dimensions are squeezed out from the returned
Expand Down
14 changes: 8 additions & 6 deletions lib/mpl_toolkits/mplot3d/axes3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ def __init__(
axis. A positive angle spins the camera clockwise, causing the
scene to rotate counter-clockwise.
sharez : Axes3D, optional
Other Axes to share z-limits with.
Other Axes to share z-limits with. Note that it is not possible to
unshare axes.
proj_type : {'persp', 'ortho'}
The projection type, default 'persp'.
box_aspect : 3-tuple of floats, default: None
Expand All @@ -107,7 +108,8 @@ def __init__(
The focal length can be computed from a desired Field Of View via
the equation: focal_length = 1/tan(FOV/2)
shareview : Axes3D, optional
Other Axes to share view angles with.
Other Axes to share view angles with. Note that it is not possible
to unshare axes.

**kwargs
Other optional keyword arguments:
Expand Down Expand Up @@ -1307,7 +1309,7 @@ def sharez(self, other):

This is equivalent to passing ``sharez=other`` when constructing the
Axes, and cannot be used if the z-axis is already being shared with
another Axes.
another Axes. Note that it is not possible to unshare axes.
"""
_api.check_isinstance(Axes3D, other=other)
if self._sharez is not None and other is not self._sharez:
Expand All @@ -1324,9 +1326,9 @@ def shareview(self, other):
"""
Share the view angles with *other*.

This is equivalent to passing ``shareview=other`` when
constructing the Axes, and cannot be used if the view angles are
already being shared with another Axes.
This is equivalent to passing ``shareview=other`` when constructing the
Axes, and cannot be used if the view angles are already being shared
with another Axes. Note that it is not possible to unshare axes.
"""
_api.check_isinstance(Axes3D, other=other)
if self._shareview is not None and other is not self._shareview:
Expand Down
Loading