我试图在我的树莓派上实时绘制这个向量。我完成一个循环的最快速度是 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)
谢谢你!