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

Skip to content

Commit f306b5e

Browse files
committed
Document that axes unsharing is impossible.
The feature may perhaps be desirable, but let's document the current state of things.
1 parent 57e187a commit f306b5e

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
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: 3 additions & 2 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
@@ -1308,7 +1309,7 @@ def sharez(self, other):
13081309
13091310
This is equivalent to passing ``sharez=other`` when constructing the
13101311
Axes, and cannot be used if the z-axis is already being shared with
1311-
another Axes.
1312+
another Axes. Note that it is not possible to unshare axes.
13121313
"""
13131314
_api.check_isinstance(Axes3D, other=other)
13141315
if self._sharez is not None and other is not self._sharez:

0 commit comments

Comments
 (0)