使用mayavi进行实时绘图

时间:2018-05-17 15:08:04

标签: python python-3.x scipy mayavi

我编写了一个程序,用于在3d环境中绘制点,其中使用循环更新数据。但是在循环中,整个数组被反复绘制。由于我想增加1000多点,这将是个人电脑的负担。任何人都可以建议一种方法来实时绘制单个点,而不再重复绘制数组,但获得与此程序相同的输出,谢谢。

import serial
from time import time,sleep
import numpy as np
from mayavi import mlab
from random import*

rebound=[]

xs=[]
ys=[]
zs=[]

@mlab.animate(delay=100)
def anim():
    i=0
    while True:
        x= randint(0,1024)
        y= randint(0,1024)
        z= randint(0,1024)
        xs.append(x)
        ys.append(y)
        zs.append(z)
        plt = mlab.points3d(xs,ys,zs)
        yield

anim()

0 个答案:

没有答案
相关问题