plt.cla() plt.close("all")
循环中创建太多plt对象,在每个循环中加入上面两句
RuntimeWarning: More than 20 figures have been opened.
原文:https://www.cnblogs.com/ywheunji/p/12243532.html