RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (
matplotlib.pyplot.figure
) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParamfigure.max_open_warning
).
max_open_warning, RuntimeWarning)
If you intend to knowingly keep many plots in memory, but don't want to be warned about it, you can update your options prior to generating figures.
plt.rcParams.update({'figure.max_open_warning': 0})
plt.cla()
# clear a axis
plt.clf()
# clear the entire current figure with all its axes, but leaved the window opened, such that it may be reused for other plots;
plt.close()
# close the window,which will be the current window,
plt.close('all')
will close all open figures
参考网址:https://stackoverflow.com/questions/21884271/warning-about-too-many-open-figures
网友评论