Skip to content

Fix subplot docs #29471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/api/axes_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -620,5 +620,6 @@ Other
Axes.get_transformed_clip_path_and_affine
Axes.has_data
Axes.set
Axes.remove

.. autoclass:: matplotlib.axes.Axes.ArtistList
14 changes: 4 additions & 10 deletions lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted above, this is under-indented.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I tried making changes.. I hope the checks passes this time 😭

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now you need to click through the CircleCI job. I usually download the raw log and search for "Warning" to see why the doc build failed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is also a section below the failed build output called "Extract possible build errors and warnings". It seems you are trying to link to Axes.remove, which is not in the docs. Perhaps it should be added under "Other" here.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried adding 'axes.remove' in other still checks failed, am i suppose to add '.. automethod:: matplotlib.axes.Axes.remove' instead ??

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rcomer Thankyou so much for the proper explanation & guidance ..I'll work around it😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I installed pre-commit hooks & pushed the changes.. you can review it once & ask me for any further changes if required.

Copy link
Contributor Author

@Khushikela29 Khushikela29 Jan 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something wrong in the PR ?? I edited the white space thing in documentation still the error ?

Copy link
Member

@rcomer rcomer Jan 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing wrong, just sometimes things fall off the to-do list. Thanks for the reminder, and for your work on this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries :)
I actually wanted to thankyou guys for being patient in this PR, I really appreciate your guidance & patience on this PR.. looking forward for more meaningful contributions & learning ahead!!
Thankyouu 😄

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.
Expand Down
Loading