美文网首页
python:more than 20 figures have

python:more than 20 figures have

作者: 夏天不热也不冷 | 来源:发表于2019-11-11 19:53 被阅读0次

    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 rcParam figure.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

    相关文章

      网友评论

          本文标题:python:more than 20 figures have

          本文链接:https://www.haomeiwen.com/subject/gkkxictx.html