|
72 | 72 | },
|
73 | 73 | {
|
74 | 74 | "cell_type": "code",
|
75 |
| - "execution_count": null, |
| 75 | + "execution_count": 1, |
76 | 76 | "id": "9aeb2e39-cc13-4662-ada0-cfed7ee2b26c",
|
77 | 77 | "metadata": {
|
78 | 78 | "tags": []
|
|
87 | 87 | },
|
88 | 88 | {
|
89 | 89 | "cell_type": "code",
|
90 |
| - "execution_count": null, |
| 90 | + "execution_count": 2, |
91 | 91 | "id": "fb57c3d3-f20d-4d88-9e7a-04b9309bc637",
|
92 | 92 | "metadata": {
|
93 | 93 | "tags": []
|
|
105 | 105 | "id": "0f02c2fe-e77d-447d-9483-da66574a3950",
|
106 | 106 | "metadata": {},
|
107 | 107 | "source": [
|
108 |
| - "**Additionally, the data we are using throughout these demos can be downloaded from Zenodo. We have written a helper function to download them for you.**" |
| 108 | + "**Additionally, the data we are using throughout these demos can be downloaded from Zenodo.**" |
109 | 109 | ]
|
110 | 110 | },
|
111 | 111 | {
|
112 | 112 | "cell_type": "code",
|
113 |
| - "execution_count": null, |
| 113 | + "execution_count": 3, |
114 | 114 | "id": "99f0c624-85a6-4a42-92b0-30b0b04075b4",
|
115 | 115 | "metadata": {
|
116 | 116 | "tags": []
|
|
122 | 122 | },
|
123 | 123 | {
|
124 | 124 | "cell_type": "code",
|
125 |
| - "execution_count": null, |
| 125 | + "execution_count": 4, |
126 | 126 | "id": "630e4762-de01-47fe-be9d-547182a1fbf9",
|
127 | 127 | "metadata": {
|
128 | 128 | "tags": []
|
129 | 129 | },
|
130 |
| - "outputs": [], |
| 130 | + "outputs": [ |
| 131 | + { |
| 132 | + "name": "stdout", |
| 133 | + "output_type": "stream", |
| 134 | + "text": [ |
| 135 | + "data already exists\n" |
| 136 | + ] |
| 137 | + } |
| 138 | + ], |
131 | 139 | "source": [
|
132 | 140 | "download_data()"
|
133 | 141 | ]
|
|
142 | 150 | },
|
143 | 151 | {
|
144 | 152 | "cell_type": "code",
|
145 |
| - "execution_count": null, |
| 153 | + "execution_count": 5, |
146 | 154 | "id": "237823b7-e2c0-4e2f-9ee8-e3fc2b4453c4",
|
147 | 155 | "metadata": {
|
148 | 156 | "tags": []
|
149 | 157 | },
|
150 |
| - "outputs": [], |
| 158 | + "outputs": [ |
| 159 | + { |
| 160 | + "data": { |
| 161 | + "application/vnd.jupyter.widget-view+json": { |
| 162 | + "model_id": "ce138ebe1a3249359008c054c53b5aee", |
| 163 | + "version_major": 2, |
| 164 | + "version_minor": 0 |
| 165 | + }, |
| 166 | + "text/plain": [ |
| 167 | + "RFBOutputContext()" |
| 168 | + ] |
| 169 | + }, |
| 170 | + "metadata": {}, |
| 171 | + "output_type": "display_data" |
| 172 | + } |
| 173 | + ], |
151 | 174 | "source": [
|
152 | 175 | "# create a `Plot` instance\n",
|
153 | 176 | "plot = fpl.Plot(size=(600, 500))\n",
|
|
192 | 215 | },
|
193 | 216 | {
|
194 | 217 | "cell_type": "code",
|
195 |
| - "execution_count": null, |
| 218 | + "execution_count": 6, |
196 | 219 | "id": "de816c88-1c4a-4071-8a5e-c46c93671ef5",
|
197 | 220 | "metadata": {
|
198 | 221 | "tags": []
|
|
216 | 239 | },
|
217 | 240 | {
|
218 | 241 | "cell_type": "code",
|
219 |
| - "execution_count": null, |
| 242 | + "execution_count": 7, |
220 | 243 | "id": "83b2db1b-2783-4e89-bcf3-66bb6e09e18a",
|
221 | 244 | "metadata": {
|
222 | 245 | "tags": []
|
|
237 | 260 | },
|
238 | 261 | {
|
239 | 262 | "cell_type": "code",
|
240 |
| - "execution_count": null, |
| 263 | + "execution_count": 8, |
241 | 264 | "id": "3e298c1c-7551-4401-ade0-b9af7d2bbe23",
|
242 | 265 | "metadata": {
|
243 | 266 | "tags": []
|
|
257 | 280 | },
|
258 | 281 | {
|
259 | 282 | "cell_type": "code",
|
260 |
| - "execution_count": null, |
| 283 | + "execution_count": 9, |
261 | 284 | "id": "ea100318-023c-4963-b859-8c2a8fcce301",
|
262 | 285 | "metadata": {
|
263 | 286 | "tags": []
|
|
270 | 293 | },
|
271 | 294 | {
|
272 | 295 | "cell_type": "code",
|
273 |
| - "execution_count": null, |
| 296 | + "execution_count": 10, |
274 | 297 | "id": "a1320f9f-fff5-4b9b-9a49-0695042ab8ab",
|
275 | 298 | "metadata": {
|
276 | 299 | "tags": []
|
|
282 | 305 | },
|
283 | 306 | {
|
284 | 307 | "cell_type": "code",
|
285 |
| - "execution_count": null, |
| 308 | + "execution_count": 11, |
286 | 309 | "id": "4c369d3d-7219-4231-80cd-ce82b6a67a20",
|
287 | 310 | "metadata": {
|
288 | 311 | "tags": []
|
|
316 | 339 | },
|
317 | 340 | {
|
318 | 341 | "cell_type": "code",
|
319 |
| - "execution_count": null, |
| 342 | + "execution_count": 12, |
320 | 343 | "id": "aadd757f-6379-4f52-a709-46aa57c56216",
|
321 | 344 | "metadata": {
|
322 | 345 | "tags": []
|
323 | 346 | },
|
324 |
| - "outputs": [], |
| 347 | + "outputs": [ |
| 348 | + { |
| 349 | + "data": { |
| 350 | + "application/vnd.jupyter.widget-view+json": { |
| 351 | + "model_id": "2c658310843f4d0bb1cadd993d7a26ab", |
| 352 | + "version_major": 2, |
| 353 | + "version_minor": 0 |
| 354 | + }, |
| 355 | + "text/plain": [ |
| 356 | + "RFBOutputContext()" |
| 357 | + ] |
| 358 | + }, |
| 359 | + "metadata": {}, |
| 360 | + "output_type": "display_data" |
| 361 | + }, |
| 362 | + { |
| 363 | + "name": "stderr", |
| 364 | + "output_type": "stream", |
| 365 | + "text": [ |
| 366 | + "/home/clewis7/repos/fastplotlib/fastplotlib/graphics/_features/_base.py:34: UserWarning: converting float64 array to float32\n", |
| 367 | + " warn(f\"converting {array.dtype} array to float32\")\n" |
| 368 | + ] |
| 369 | + } |
| 370 | + ], |
325 | 371 | "source": [
|
326 | 372 | "# create another `Plot` instance\n",
|
327 | 373 | "plot_v = fpl.Plot(size=(600, 500))\n",
|
|
351 | 397 | " display(plot_v.show())"
|
352 | 398 | ]
|
353 | 399 | },
|
354 |
| - { |
355 |
| - "cell_type": "markdown", |
356 |
| - "id": "b313eda1-6e6c-466f-9fd5-8b70c1d3c110", |
357 |
| - "metadata": {}, |
358 |
| - "source": [ |
359 |
| - "### We can share controllers across plots\n", |
360 |
| - "\n", |
361 |
| - "This example creates a new plot, but it synchronizes the pan-zoom controller" |
362 |
| - ] |
363 |
| - }, |
364 |
| - { |
365 |
| - "cell_type": "code", |
366 |
| - "execution_count": null, |
367 |
| - "id": "86e70b1e-4328-4035-b992-70dff16d2a69", |
368 |
| - "metadata": { |
369 |
| - "tags": [] |
370 |
| - }, |
371 |
| - "outputs": [], |
372 |
| - "source": [ |
373 |
| - "plot_sync = fpl.Plot(controller=plot_v.controller, size=(600, 500))\n", |
374 |
| - "\n", |
375 |
| - "data = np.random.rand(512, 512)\n", |
376 |
| - "\n", |
377 |
| - "image_graphic_instance = plot_sync.add_image(data=data, cmap=\"viridis\")\n", |
378 |
| - "\n", |
379 |
| - "# you will need to define a new animation function for this graphic\n", |
380 |
| - "def update_data_2():\n", |
381 |
| - " new_data = np.random.rand(512, 512)\n", |
382 |
| - " # alternatively, you can use the stored reference to the graphic as well instead of indexing the Plot\n", |
383 |
| - " image_graphic_instance.data = new_data\n", |
384 |
| - "\n", |
385 |
| - "plot_sync.add_animations(update_data_2)\n", |
386 |
| - "\n", |
387 |
| - "plot_sync.show()" |
388 |
| - ] |
389 |
| - }, |
390 |
| - { |
391 |
| - "cell_type": "markdown", |
392 |
| - "id": "f226c9c2-8d0e-41ab-9ab9-1ae31fd91de5", |
393 |
| - "metadata": {}, |
394 |
| - "source": [ |
395 |
| - "#### Keeping a reference to the Graphic instance, as shown above `image_graphic_instance`, is useful if you're creating something where you need flexibility in the naming of the graphics" |
396 |
| - ] |
397 |
| - }, |
398 | 400 | {
|
399 | 401 | "cell_type": "code",
|
400 |
| - "execution_count": null, |
401 |
| - "id": "bd073e07-5721-4957-8a16-0767b9d64d25", |
| 402 | + "execution_count": 13, |
| 403 | + "id": "99d234c6-220a-4093-a6a0-6036d2e40000", |
402 | 404 | "metadata": {
|
403 | 405 | "tags": []
|
404 | 406 | },
|
405 | 407 | "outputs": [],
|
406 | 408 | "source": [
|
407 |
| - "sc.close()" |
408 |
| - ] |
409 |
| - }, |
410 |
| - { |
411 |
| - "cell_type": "markdown", |
412 |
| - "id": "d11fabb7-7c76-4e94-893d-80ed9ee3be3d", |
413 |
| - "metadata": {}, |
414 |
| - "source": [ |
415 |
| - "### You can also use `ipywidgets.VBox` and `HBox` to stack plots." |
416 |
| - ] |
417 |
| - }, |
418 |
| - { |
419 |
| - "cell_type": "code", |
420 |
| - "execution_count": null, |
421 |
| - "id": "ef9743b3-5f81-4b79-9502-fa5fca08e56d", |
422 |
| - "metadata": { |
423 |
| - "tags": [] |
424 |
| - }, |
425 |
| - "outputs": [], |
426 |
| - "source": [ |
427 |
| - "VBox([plot_v.show(), plot_sync.show()])" |
428 |
| - ] |
429 |
| - }, |
430 |
| - { |
431 |
| - "cell_type": "code", |
432 |
| - "execution_count": null, |
433 |
| - "id": "e8b3468a-0c92-42b0-8158-6c3c4cb83fa1", |
434 |
| - "metadata": { |
435 |
| - "tags": [] |
436 |
| - }, |
437 |
| - "outputs": [], |
438 |
| - "source": [ |
439 |
| - "# close plots\n", |
440 | 409 | "plot_v.close()\n",
|
441 |
| - "plot_sync.close()" |
| 410 | + "sc.close()" |
442 | 411 | ]
|
443 | 412 | },
|
444 | 413 | {
|
|
0 commit comments