Skip to content

Commit ab2f68b

Browse files
committed
reduce n
1 parent 1ba4108 commit ab2f68b

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

examples/scatter/spinning_spiral.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22
Spinning spiral scatter
33
=======================
44
5-
Example of a spinning spiral scatter. Runs at 125 fps on an AMD RX 570.
5+
Example of a spinning spiral scatter.
6+
7+
This example with 1 million points runs at 125 fps on an AMD RX 570.
68
"""
79

810
# test_example = false
9-
# sphinx_gallery_pygfx_docs = 'animate 10s'
11+
# sphinx_gallery_pygfx_docs = 'animate 15s'
1012

1113
import numpy as np
1214
import fastplotlib as fpl
1315

1416
# number of points
15-
n = 1_000_000
17+
n = 100_000
1618

1719
# create data in the shape of a spiral
1820
phi = np.linspace(0, 30, n)
@@ -29,18 +31,18 @@
2931
figure = fpl.Figure(
3032
cameras="3d",
3133
size=(700, 560),
32-
canvas_kwargs={"max_fps": 500, "vsync": False}
34+
canvas_kwargs={"max_fps": 600, "vsync": False}
3335
)
3436

35-
spiral = figure[0, 0].add_scatter(data, cmap="viridis_r", alpha=0.1, sizes=sizes)
37+
spiral = figure[0, 0].add_scatter(data, cmap="viridis_r", alpha=0.5, sizes=sizes)
3638

3739
# pre-generate normally distributed data to jitter the points before each render
38-
jitter = np.random.normal(scale=0.01, size=n * 3).reshape((n, 3))
40+
jitter = np.random.normal(scale=0.001, size=n * 3).reshape((n, 3))
3941

4042

4143
def update():
4244
# rotate around y axis
43-
spiral.rotate(0.005, axis="y")
45+
spiral.rotate(0.0005, axis="y")
4446

4547
# add small jitter
4648
spiral.data[:] += jitter

0 commit comments

Comments
 (0)