widgetti / ipyvolume

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

Animating Multiple Datasets #309

Open ghost opened 4 years ago

ghost commented 4 years ago

For a school project I have two datasets that contain the stellar and dark matter components of a galaxy. I would like to animate to show how they move together in time, but have no idea how to animate the two datasets simultaneously.

I have tried the following:

fig = ipv.figure(width=800, height=500)

s1 = ipv.scatter(orbit_stellar.xyz.value, color = 'black', marker = 'sphere', size = 0.5) s2 = ipv.scatter(orbit_dmatter.xyz.value, color = 'red', marker = 'sphere', size = 0.5)

ipv.xyzlim(-15,15) ipv.xlabel('x [kpc]') ipv.ylabel('y [kpc]') ipv.zlabel('z [kpc]')

ipv.animation_control(s1) ipv.animation_control(s2)

ipv.show()

but it gives me two separate animations within the same frame.

How do I simulate two datasets simultaneously in a single frame?

dmadisetti commented 4 years ago

ipv.animation_control([s1, s2]) or ipv.animation_control(fig.scatters)