我试图在我的覆盆子pi上实时绘制这个矢量。 我设法完成循环的最快速度是0.6秒。 有没有办法加快速度?
import numpy as np
import time
import matplotlib.pyplot as plot
plot.ion()
fig = plot.figure()
vector = np.zeros((50,1))
vector[0] = 1
hi = plot.imshow(vector)
plot.show()
i = 0
while True:
begin = time.time()
i = i+1
vector[i] = 1
hi.set_data(vector)
plot.draw()
vector = np.zeros((50,1))
print (time.time() - begin)
谢谢你!