Improve docs regarding plt.close().#29839
Conversation
There was a problem hiding this comment.
Can we get this more in the direction that close() is the explicit way to deregister a figure from pyplot? I want to prevent the implication that every figure() must be paired with close(). Closing a figure window that was created using show() also deregisters the figure from pyplot and hence close() is not needed in that usage scenario.
Something like
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 byshow()automatically deregisters the figure. For all other use cases, most prominentlysavefig()withoutshow(), the figure must be deregistered explicitly usingclose().
…839-on-v3.10.x Backport PR #29839 on branch v3.10.x (Improve docs regarding plt.close().)

See #29782 (comment)
PR summary
PR checklist