データには2Dのhistogram2dが付属しているため、データをアニメーション化する必要があります(おそらく3D以降ですが、mayaviの方が優れていると聞いています)。
コードは次のとおりです。
import numpy as np
import numpy.random
import matplotlib.pyplot as plt
import time, matplotlib
plt.ion()
# Generate some test data
x = np.random.randn(50)
y = np.random.randn(50)
heatmap, xedges, yedges = np.histogram2d(x, y, bins=5)
extent = [xedges[0], xedges[-1], yedges[0], yedges[-1]]
# start counting for FPS
tstart = time.time()
for i in range(10):
x = np.random.randn(50)
y = np.random.randn(50)
heatmap, xedges, yedges = np.histogram2d(x, y, bins=5)
plt.clf()
plt.imshow(heatmap, extent=extent)
plt.draw()
# calculate and print FPS
print 'FPS:' , 20/(time.time()-tstart)
3 fps を返しますが、明らかに遅すぎます。各反復で numpy.random を使用していますか? ブリットを使用する必要がありますか? もしそうなら、どのように?
ドキュメントにはいくつかの良い例がありますが、私にとってはすべてが何をするのかを理解する必要があります。