Skip to content

Commit 2d5d068

Browse files
committed
Update example
Signed-off-by: martinRenou <[email protected]>
1 parent 13ed5d1 commit 2d5d068

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

examples/RoughCanvas.ipynb

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,41 @@
197197
"\n",
198198
"c"
199199
]
200+
},
201+
{
202+
"cell_type": "markdown",
203+
"metadata": {},
204+
"source": [
205+
"## Draw thousands of shapes at once"
206+
]
207+
},
208+
{
209+
"cell_type": "code",
210+
"execution_count": null,
211+
"metadata": {},
212+
"outputs": [],
213+
"source": [
214+
"n_particles = 3_000\n",
215+
"\n",
216+
"import numpy as np\n",
217+
"\n",
218+
"x = np.array(np.random.rayleigh(250, n_particles), dtype=np.int32)\n",
219+
"y = np.array(np.random.rayleigh(250, n_particles), dtype=np.int32)\n",
220+
"size = np.random.randint(4, 8, n_particles)\n",
221+
"\n",
222+
"canvas = RoughCanvas(width=800, height=500)\n",
223+
"\n",
224+
"canvas"
225+
]
226+
},
227+
{
228+
"cell_type": "code",
229+
"execution_count": null,
230+
"metadata": {},
231+
"outputs": [],
232+
"source": [
233+
"canvas.fill_rects(x, y, size)"
234+
]
200235
}
201236
],
202237
"metadata": {
@@ -215,7 +250,7 @@
215250
"name": "python",
216251
"nbconvert_exporter": "python",
217252
"pygments_lexer": "ipython3",
218-
"version": "3.8.3"
253+
"version": "3.8.5"
219254
}
220255
},
221256
"nbformat": 4,

0 commit comments

Comments
 (0)