matplotlib.pyplot.close#
- matplotlib.pyplot.close(fig=None)[source]#
Close a figure window, and unregister it from pyplot.
- Parameters:
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 byshow()
automatically deregisters the figure. For all other use cases, most prominentlysavefig()
withoutshow()
, the figure must be deregistered explicitly usingclose()
.