Skip to content

Commit c0a9260

Browse files
authored
Merge pull request #29513 from meeseeksmachine/auto-backport-of-pr-29471-on-v3.10.x
Backport PR #29471 on branch v3.10.x (Fix subplot docs)
2 parents 5d2d694 + e6a9e25 commit c0a9260

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

doc/api/axes_api.rst

+1
Original file line numberDiff line numberDiff line change
@@ -616,5 +616,6 @@ Other
616616
Axes.get_transformed_clip_path_and_affine
617617
Axes.has_data
618618
Axes.set
619+
Axes.remove
619620

620621
.. autoclass:: matplotlib.axes.Axes.ArtistList

lib/matplotlib/pyplot.py

+4-10
Original file line numberDiff line numberDiff line change
@@ -1449,16 +1449,10 @@ def subplot(*args, **kwargs) -> Axes:
14491449
14501450
Notes
14511451
-----
1452-
Creating a new Axes will delete any preexisting Axes that
1453-
overlaps with it beyond sharing a boundary::
1454-
1455-
import matplotlib.pyplot as plt
1456-
# plot a line, implicitly creating a subplot(111)
1457-
plt.plot([1, 2, 3])
1458-
# now create a subplot which represents the top plot of a grid
1459-
# with 2 rows and 1 column. Since this subplot will overlap the
1460-
# first, the plot (and its Axes) previously created, will be removed
1461-
plt.subplot(211)
1452+
.. versionchanged:: 3.8
1453+
In versions prior to 3.8, any preexisting Axes that overlap with the new Axes
1454+
beyond sharing a boundary was deleted. Deletion does not happen in more
1455+
recent versions anymore. Use `.Axes.remove` explicitly if needed.
14621456
14631457
If you do not want this behavior, use the `.Figure.add_subplot` method
14641458
or the `.pyplot.axes` function instead.

0 commit comments

Comments
 (0)