warning about too many open figures

后端 未结 6 1903
陌清茗
陌清茗 2020-11-29 15:38

In a script where I create many figures with fix, ax = plt.subplots(...), I get the warning RuntimeWarning: More than 20 figures have been opened. Figures c

6条回答
  •  生来不讨喜
    2020-11-29 16:14

    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.

    import matplotlib.pyplot as plt
    plt.rcParams.update({'figure.max_open_warning': 0})
    

    This will prevent the warning from being emitted without changing anything about the way memory is managed.

提交回复
热议问题