1

ラズベリーパイでこのベクトルをリアルタイムでプロットしようとしています。ループを完了するのにかかった最速は 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)

ありがとう!

4

0 に答える 0