3
オンライン検索の助けを借りて次のコードを書いています。ここに私の意図は、私はちょうど、Y軸の範囲が連続的に変化する参照x軸上の時間と上記のコードではy軸matplotlibを使ってリアルタイムグラフをプロットできません
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import time
import numpy as np
fig = plt.figure()
ax1 = fig.add_subplot(1,1,1)
def animate(i):
xar = []
yar = []
x,y = time.time(), np.random.rand()
xar.append(x)
yar.append(y)
ax1.clear()
ax1.plot(xar,yar)
ani = animation.FuncAnimation(fig, animate, interval=1000)
plt.show()
上のいくつかのランダムに生成された値をリアルタイムでグラフを取得することで、グラフが表示されません。図では、