【发布时间】:2015-05-28 03:22:28
【问题描述】:
我正在尝试使用 matplotlib 的内置动画例程为表面设置动画,但我不确定我哪里出错了。我正在从磁盘加载一些文件,如下所示:
def update_profile(j):
File('u'+str(j)+'.xml')>>u
u_tri = u.compute_vertex_values(mesh)
ax.clear()
plot = ax.plot_trisurf(mesh_tri, u_tri,cmap=cm.coolwarm,edgecolors='none')
ax.set_title('$t$ = '+ str(dt * j))
return plot,
fig =plt.figure()
ax = fig.gca(projection='3d')
animation.FuncAnimation(fig, update_profile, range(0,n_steps+1),
interval=10)
plt.show()
加载和绘制单个文件时没有问题。
【问题讨论】:
-
你没有说问题是什么。你也没有提到任何错误信息。
-
啊,对不起。所以它绘制了初始帧,然后什么都不做;没有错误,但它似乎永远不会更新图像。
标签: python matplotlib