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

Skip to content

Commit fbdf7f3

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 fbdf7f3

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
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

0 commit comments

Comments
 (0)