From 43e875b49d7b55e183f58dd6c1223a5489ce4c5c Mon Sep 17 00:00:00 2001 From: Khushikela29 Date: Sat, 18 Jan 2025 22:35:56 +0530 Subject: [PATCH 1/4] doc:updates the docstring --- lib/matplotlib/pyplot.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index 2dd14404c98e..580bd3db27d8 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -1450,16 +1450,10 @@ def subplot(*args, **kwargs) -> Axes: Notes ----- - Creating a new Axes will delete any preexisting Axes that - overlaps with it beyond sharing a boundary:: - - import matplotlib.pyplot as plt - # plot a line, implicitly creating a subplot(111) - plt.plot([1, 2, 3]) - # now create a subplot which represents the top plot of a grid - # with 2 rows and 1 column. Since this subplot will overlap the - # first, the plot (and its Axes) previously created, will be removed - plt.subplot(211) + .. versionchanged:: 3.8 + In versions prior to 3.8, any preexisting Axes that overlap with the new Axes + beyond sharing a boundary was deleted. Deletion does not happen in more + recent versions anymore. Use `.Axes.remove` explicitly if needed. If you do not want this behavior, use the `.Figure.add_subplot` method or the `.pyplot.axes` function instead. From 7c8ba1bfeeae79f9e551859808b0b69af483c360 Mon Sep 17 00:00:00 2001 From: Khushikela29 Date: Sat, 18 Jan 2025 23:02:57 +0530 Subject: [PATCH 2/4] fixed linting error --- lib/matplotlib/pyplot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index 580bd3db27d8..43c4ac70bff0 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -1451,9 +1451,9 @@ def subplot(*args, **kwargs) -> Axes: Notes ----- .. versionchanged:: 3.8 - In versions prior to 3.8, any preexisting Axes that overlap with the new Axes - beyond sharing a boundary was deleted. Deletion does not happen in more - recent versions anymore. Use `.Axes.remove` explicitly if needed. + In versions prior to 3.8, any preexisting Axes that overlap with the new Axes + beyond sharing a boundary was deleted. Deletion does not happen in more + recent versions anymore. Use `.Axes.remove` explicitly if needed. If you do not want this behavior, use the `.Figure.add_subplot` method or the `.pyplot.axes` function instead. From b90d19d5639717feaa61724245f39f6c69c607e4 Mon Sep 17 00:00:00 2001 From: Khushikela29 Date: Sun, 19 Jan 2025 10:23:44 +0530 Subject: [PATCH 3/4] Fixed failing test of Python 3.12 --- doc/api/axes_api.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/api/axes_api.rst b/doc/api/axes_api.rst index f389226d907a..bf03337f10a1 100644 --- a/doc/api/axes_api.rst +++ b/doc/api/axes_api.rst @@ -620,5 +620,6 @@ Other Axes.get_transformed_clip_path_and_affine Axes.has_data Axes.set + Axes.remove .. autoclass:: matplotlib.axes.Axes.ArtistList From 107cf86dee2505e6d495683da47a161275aac443 Mon Sep 17 00:00:00 2001 From: Khushikela29 Date: Sun, 19 Jan 2025 19:46:21 +0530 Subject: [PATCH 4/4] fix:remove trailing whitespace --- doc/api/axes_api.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/axes_api.rst b/doc/api/axes_api.rst index bf03337f10a1..030655458c26 100644 --- a/doc/api/axes_api.rst +++ b/doc/api/axes_api.rst @@ -620,6 +620,6 @@ Other Axes.get_transformed_clip_path_and_affine Axes.has_data Axes.set - Axes.remove + Axes.remove .. autoclass:: matplotlib.axes.Axes.ArtistList