【发布时间】:2017-02-03 15:02:17
【问题描述】:
我正在绘制动画,我想在观看动画时查看动画的时间/步骤。
fig = plt.figure()
ax1 = fig.add_subplot(1, 1, 1)
cax1 = ax1.matshow(coherence_matrices[0], cmap='YlOrRd')
time = ax1.annotate(0, xy=(1, 8), xytext=(1, 8))
def animate(i):
cax1.set_array(coherence_matrices[i])
time.set_text(i)
return time, cax1
anim = animation.FuncAnimation(fig, animate,
frames=int((4000-window_size)/window_step), interval=80, blit=True)
plt.show()
我只是想出了这个解决方案,它应该使直方图顶部出现迭代次数,但什么也没有出现。我想知道哪里出了问题,并且有一种更简单的方法可以查看动画中的计时器。
非常感谢。
【问题讨论】:
标签: python python-3.x animation matplotlib plot