widgetti / ipyvolume

3d plotting for Python in the Jupyter notebook based on IPython widgets using WebGL
MIT License
1.95k stars 236 forks source link

Real time update for quiver #247

Open grajohnt opened 5 years ago

grajohnt commented 5 years ago

As a followup on issue #235 :

The approach outlined there does not work for updating vectors in quiver, since quiver returns a scatter object. Attempting to update u/v/w returns:

TraitError: Class Scatter does not have a trait named u.

What I would like to do is to animate a time series of trajectories (in this case, airplanes). The challenge is rather than a fixed-dimension numpy array, this requires an unknown number of individual points/vectors to be made, animated, and left alone (or destroyed). As far as I can tell, I can't do this either with updating the graph in a loop due to the issue above, or by using the animate features, since that assumes a fixed-dimension array that steps through one dimension.

Perhaps beyond scope for ipyvolume, but any suggestions would be appreciated...

maartenbreddels commented 5 years ago

Hi, thanks for you patience :)

The trait name is vx/vy/vz instead, see here: https://github.com/maartenbreddels/ipyvolume/blob/fbd1ba04030aa13fdfc1b4a51331691492aa03a1/ipyvolume/widgets.py#L85 Or, with not the best docstring here: https://ipyvolume.readthedocs.io/en/latest/api.html#ipyvolume.widgets.Scatter

What you could try doing is making the arrays fixed size, but put the size of the 'missing' elements to zero. Would that work?

cheers,

Maarten