Animating a mayavi points3d plot

依然范特西╮ 提交于 2019-11-27 22:59:35

Just change to:

...

    for (x, y, z) in zip(xs, ys, zs):
        print('Updating scene...')
        plt.mlab_source.set(x=x, y=y, z=z)
        yield

...

you don't even need the f.scene.render(), according to documentation mlab_source.set guarantees the refresh.

Also since shape of your data doesn't change you don't need to use mlab_source.reset.

I also tested and works fine.

Have you tried mlab_source.reset? It works even when the length of the x, y, and z arrays are changed.

In your case, it'll be: plt.mlab_source.reset(x=x,y=y,z=z).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!