Hi

I'm trying to plot the trajectory of a particle in 3d using mplot3d. I
tried to follow the example of an animated 3d plot on the matplotlib
website but I'm having trouble with the updating of the data point being
plotted at each frame. Does anyone know how to do this?

So far I have:

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d.axes3d import Axes3D
from matplotlib.animation import FuncAnimation


def update_plot(num, data, sc):
    sc.set_array(data[num])
    return sc


def main():
    numframes = 2
    data = np.random.rand(10, 3)# a (time, position) array

    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')

    ix, iy, iz = data[0]
    sc = ax.scatter(ix, iy, iz, c='k')

    ani = FuncAnimation(fig, update_plot, frames=numframes,
            fargs=(data,sc))
    plt.show()


if __name__ == '__main__':
    main()


This just changes the color of the initial marker. I also tried to use
sc.set_3d_properties but it is not clear to me what the arguments should be
here, I kept getting an error... If anyone has done this before I'd love to
see an example.

Thanks,
Andrew
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_nov
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to