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

Skip to content

Commit 62bf05a

Browse files
Merge pull request #28359 from anntzer/unshare
Document that axes unsharing is impossible.
2 parents 6e23101 + 6779f1b commit 62bf05a

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 4 additions & 3 deletions
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,8 +1651,9 @@ def subplots(
16511651
on, use `~matplotlib.axes.Axes.tick_params`.
16521652
16531653
When subplots have a shared axis that has units, calling
1654-
`~matplotlib.axis.Axis.set_units` will update each axis with the
1655-
new units.
1654+
`.Axis.set_units` will update each axis with the new units.
1655+
1656+
Note that it is not possible to unshare axes.
16561657
16571658
squeeze : bool, default: True
16581659
- If True, extra dimensions are squeezed out from the returned

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ def __init__(
8484
axis. A positive angle spins the camera clockwise, causing the
8585
scene to rotate counter-clockwise.
8686
sharez : Axes3D, optional
87-
Other Axes to share z-limits with.
87+
Other Axes to share z-limits with. Note that it is not possible to
88+
unshare axes.
8889
proj_type : {'persp', 'ortho'}
8990
The projection type, default 'persp'.
9091
box_aspect : 3-tuple of floats, default: None
@@ -108,7 +109,8 @@ def __init__(
108109
The focal length can be computed from a desired Field Of View via
109110
the equation: focal_length = 1/tan(FOV/2)
110111
shareview : Axes3D, optional
111-
Other Axes to share view angles with.
112+
Other Axes to share view angles with. Note that it is not possible
113+
to unshare axes.
112114
113115
**kwargs
114116
Other optional keyword arguments:
@@ -1308,7 +1310,7 @@ def sharez(self, other):
13081310
13091311
This is equivalent to passing ``sharez=other`` when constructing the
13101312
Axes, and cannot be used if the z-axis is already being shared with
1311-
another Axes.
1313+
another Axes. Note that it is not possible to unshare axes.
13121314
"""
13131315
_api.check_isinstance(Axes3D, other=other)
13141316
if self._sharez is not None and other is not self._sharez:
@@ -1325,9 +1327,9 @@ def shareview(self, other):
13251327
"""
13261328
Share the view angles with *other*.
13271329
1328-
This is equivalent to passing ``shareview=other`` when
1329-
constructing the Axes, and cannot be used if the view angles are
1330-
already being shared with another Axes.
1330+
This is equivalent to passing ``shareview=other`` when constructing the
1331+
Axes, and cannot be used if the view angles are already being shared
1332+
with another Axes. Note that it is not possible to unshare axes.
13311333
"""
13321334
_api.check_isinstance(Axes3D, other=other)
13331335
if self._shareview is not None and other is not self._shareview:

0 commit comments

Comments
 (0)