美文网首页
matplotlib 动态折线图

matplotlib 动态折线图

作者: 明夜凉天 | 来源:发表于2018-01-30 10:34 被阅读0次
import numpy as np
import matplotlib.pyplot as plt

plt.axis([0, 100, 0, 1])
plt.ion()

xs=[0,0]
ys=[1,1]

for i in range(100):
    y = np.random.random()
    xs[0]=xs[1]
    ys[0]=ys[1]
    xs[1]=i
    ys[1]=y
    plt.plot(xs, ys)
    plt.pause(0.1)
        

相关文章

网友评论

      本文标题:matplotlib 动态折线图

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