RuntimeWarning: More than 20 figures have been opened.

plt.cla()
plt.close("all")

循环中创建太多plt对象,在每个循环中加入上面两句

原文地址:https://www.cnblogs.com/ywheunji/p/12243532.html