美文网首页
[转载]python plt.plot matplotlib画图

[转载]python plt.plot matplotlib画图

作者: AeroZ | 来源:发表于2020-09-01 21:27 被阅读0次

matplotlib画图的时候怎么清空图片?
https://www.zhihu.com/question/26627112
python plt.plot matplotlib画图的时候清空图片
在画图之前用cla(),亲测可以。下面是一个小例子

import matplotlib.pyplot as plt
import numpy as np 

for i in range(1, 5) :
    x = range(0, i)
    y = range(0, i) 
    y = np.array(y) * i
    # plt.cla()
    plt.scatter(x, y, c = 'r', s = 20)
    plt.savefig("./test_%d.png" % i)

作者:HWChen
链接:https://www.zhihu.com/question/26627112/answer/392521581

相关文章

网友评论

      本文标题:[转载]python plt.plot matplotlib画图

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