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

Some frames are empty in animated scatter #433

Closed zanderteller closed 1 year ago

zanderteller commented 1 year ago

Hello. I've been using Ipyvolume 0.5.2 for a long while, but I recently started from a fresh Python environment with all the latest packages (Ipyvolume 0.6.1, Jupyterlab 3.6.3, etc.), and I've run into a problem.

Below is a minimal reproduction of the problem (run in JupyterLab). The resulting animation has some empty frames, meaning the box frame is visible but the points (glyphs) are not visible. Other frames are not empty and look just as they should.

import ipyvolume as ipv
import numpy as np

rng = np.random.default_rng(1)

num_points = 10
num_frames = 20

x = rng.random((num_frames, num_points))
y = rng.random((num_frames, num_points))
z = rng.random((num_frames, num_points))

fig = ipv.figure()
s = ipv.scatter(x, z, y, size=6, marker="sphere")
ipv.animation_control(s)
ipv.show()

I'm seeing the same problem across browsers (Firefox and Chrome) and across operating systems (Mac and Windows).

Also, it seems that which frames are empty is deterministic, depending only on the total number of frames. It does not seem to depend on the exact data or the number of points. For a given total number of frames, the same frames are empty across browsers and operating systems.

Ipyvolume has been really valuable for me, and I would love to get it working again. Thanks in advance for any assistance!

maartenbreddels commented 1 year ago

Thanks a lot for making this easy to reproduce!