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

Backport PR #29839 on branch v3.10.x (Improve docs regarding plt.close().)#29848

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

Merged
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
1 change: 1 addition & 0 deletionsdoc/users/faq.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -287,6 +287,7 @@ the desired format::
import matplotlib.pyplot as plt
plt.plot([1, 2, 3])
plt.savefig('myfig.png')
plt.close()

.. seealso::

Expand Down
10 changes: 9 additions & 1 deletionlib/matplotlib/pyplot.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1170,7 +1170,7 @@ def disconnect(cid: int) -> None:

def close(fig: None | int | str | Figure | Literal["all"] = None) -> None:
"""
Close a figure window.
Close a figure window, and unregister it from pyplot.

Parameters
----------
Expand All@@ -1183,6 +1183,14 @@ def close(fig: None | int | str | Figure | Literal["all"] = None) -> None:
- ``str``: a figure name
- 'all': all figures

Notes
-----
pyplot maintains a reference to figures created with `figure()`. When
work on the figure is completed, it should be closed, i.e. deregistered
from pyplot, to free its memory (see also :rc:figure.max_open_warning).
Closing a figure window created by `show()` automatically deregisters the
figure. For all other use cases, most prominently `savefig()` without
`show()`, the figure must be deregistered explicitly using `close()`.
"""
if fig is None:
manager = _pylab_helpers.Gcf.get_active()
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp