Skip to content

Commit adf0124

Browse files
authored
Merge pull request matplotlib#28368 from meeseeksmachine/auto-backport-of-pr-28359-on-v3.9.x
Backport PR matplotlib#28359 on branch v3.9.x (Document that axes unsharing is impossible.)
2 parents 19fe788 + 394b553 commit adf0124

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

lib/matplotlib/axes/_base.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,8 @@ def __init__(self, fig,
597597
598598
sharex, sharey : `~matplotlib.axes.Axes`, optional
599599
The x- or y-`~.matplotlib.axis` is shared with the x- or y-axis in
600-
the input `~.axes.Axes`.
600+
the input `~.axes.Axes`. Note that it is not possible to unshare
601+
axes.
601602
602603
frameon : bool, default: True
603604
Whether the Axes frame is visible.
@@ -1221,7 +1222,7 @@ def sharex(self, other):
12211222
12221223
This is equivalent to passing ``sharex=other`` when constructing the
12231224
Axes, and cannot be used if the x-axis is already being shared with
1224-
another Axes.
1225+
another Axes. Note that it is not possible to unshare axes.
12251226
"""
12261227
_api.check_isinstance(_AxesBase, other=other)
12271228
if self._sharex is not None and other is not self._sharex:
@@ -1240,7 +1241,7 @@ def sharey(self, other):
12401241
12411242
This is equivalent to passing ``sharey=other`` when constructing the
12421243
Axes, and cannot be used if the y-axis is already being shared with
1243-
another Axes.
1244+
another Axes. Note that it is not possible to unshare axes.
12441245
"""
12451246
_api.check_isinstance(_AxesBase, other=other)
12461247
if self._sharey is not None and other is not self._sharey:

lib/matplotlib/figure.py

+2
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,8 @@ def subplots(self, nrows=1, ncols=1, *, sharex=False, sharey=False,
755755
When subplots have a shared axis that has units, calling
756756
`.Axis.set_units` will update each axis with the new units.
757757
758+
Note that it is not possible to unshare axes.
759+
758760
squeeze : bool, default: True
759761
- If True, extra dimensions are squeezed out from the returned
760762
array of Axes:

lib/matplotlib/pyplot.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1639,8 +1639,9 @@ def subplots(
16391639
on, use `~matplotlib.axes.Axes.tick_params`.
16401640
16411641
When subplots have a shared axis that has units, calling
1642-
`~matplotlib.axis.Axis.set_units` will update each axis with the
1643-
new units.
1642+
`.Axis.set_units` will update each axis with the new units.
1643+
1644+
Note that it is not possible to unshare axes.
16441645
16451646
squeeze : bool, default: True
16461647
- If True, extra dimensions are squeezed out from the returned

lib/mpl_toolkits/mplot3d/axes3d.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ def __init__(
8383
axis. A positive angle spins the camera clockwise, causing the
8484
scene to rotate counter-clockwise.
8585
sharez : Axes3D, optional
86-
Other Axes to share z-limits with.
86+
Other Axes to share z-limits with. Note that it is not possible to
87+
unshare axes.
8788
proj_type : {'persp', 'ortho'}
8889
The projection type, default 'persp'.
8990
box_aspect : 3-tuple of floats, default: None
@@ -107,7 +108,8 @@ def __init__(
107108
The focal length can be computed from a desired Field Of View via
108109
the equation: focal_length = 1/tan(FOV/2)
109110
shareview : Axes3D, optional
110-
Other Axes to share view angles with.
111+
Other Axes to share view angles with. Note that it is not possible
112+
to unshare axes.
111113
112114
**kwargs
113115
Other optional keyword arguments:
@@ -1307,7 +1309,7 @@ def sharez(self, other):
13071309
13081310
This is equivalent to passing ``sharez=other`` when constructing the
13091311
Axes, and cannot be used if the z-axis is already being shared with
1310-
another Axes.
1312+
another Axes. Note that it is not possible to unshare axes.
13111313
"""
13121314
_api.check_isinstance(Axes3D, other=other)
13131315
if self._sharez is not None and other is not self._sharez:
@@ -1324,9 +1326,9 @@ def shareview(self, other):
13241326
"""
13251327
Share the view angles with *other*.
13261328
1327-
This is equivalent to passing ``shareview=other`` when
1328-
constructing the Axes, and cannot be used if the view angles are
1329-
already being shared with another Axes.
1329+
This is equivalent to passing ``shareview=other`` when constructing the
1330+
Axes, and cannot be used if the view angles are already being shared
1331+
with another Axes. Note that it is not possible to unshare axes.
13301332
"""
13311333
_api.check_isinstance(Axes3D, other=other)
13321334
if self._shareview is not None and other is not self._shareview:

0 commit comments

Comments
 (0)