Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add warning when subplot kwargs are ignored#19436

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes fromall 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
4 changes: 4 additions & 0 deletionslib/matplotlib/pyplot.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1232,6 +1232,10 @@ def subplot(*args, **kwargs):
# If no existing axes match, then create a new one.
if ax is None:
ax = fig.add_subplot(*args, **kwargs)
elif kwargs:
_api.warn_external(f"An Axes with subplot spec {args} already exists. "
"The existing Axes will be returned, with all "
"keyword arguments ignored.")

bbox = ax.bbox
axes_to_delete = []
Expand Down
8 changes: 8 additions & 0 deletionslib/matplotlib/tests/test_pyplot.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -153,3 +153,11 @@ def test_nested_ion_ioff():
with plt.ioff():
plt.ion()
assert not mpl.is_interactive()


def test_subplot_warning():
ax1 = plt.subplot(2, 1, 1)
with pytest.warns(UserWarning, match='An Axes with subplot spec '
r'\(2, 1, 1\) already exists'):
ax2 = plt.subplot(2, 1, 1, polar=True)
assert ax1 is ax2

[8]ページ先頭

©2009-2025 Movatter.jp