Skip to content

Commit aebbf3e

Browse files
committed
remove sync plots, layouts
1 parent eba99ca commit aebbf3e

File tree

1 file changed

+65
-96
lines changed

1 file changed

+65
-96
lines changed

image.ipynb

+65-96
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
},
7373
{
7474
"cell_type": "code",
75-
"execution_count": null,
75+
"execution_count": 1,
7676
"id": "9aeb2e39-cc13-4662-ada0-cfed7ee2b26c",
7777
"metadata": {
7878
"tags": []
@@ -87,7 +87,7 @@
8787
},
8888
{
8989
"cell_type": "code",
90-
"execution_count": null,
90+
"execution_count": 2,
9191
"id": "fb57c3d3-f20d-4d88-9e7a-04b9309bc637",
9292
"metadata": {
9393
"tags": []
@@ -105,12 +105,12 @@
105105
"id": "0f02c2fe-e77d-447d-9483-da66574a3950",
106106
"metadata": {},
107107
"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.**"
109109
]
110110
},
111111
{
112112
"cell_type": "code",
113-
"execution_count": null,
113+
"execution_count": 3,
114114
"id": "99f0c624-85a6-4a42-92b0-30b0b04075b4",
115115
"metadata": {
116116
"tags": []
@@ -122,12 +122,20 @@
122122
},
123123
{
124124
"cell_type": "code",
125-
"execution_count": null,
125+
"execution_count": 4,
126126
"id": "630e4762-de01-47fe-be9d-547182a1fbf9",
127127
"metadata": {
128128
"tags": []
129129
},
130-
"outputs": [],
130+
"outputs": [
131+
{
132+
"name": "stdout",
133+
"output_type": "stream",
134+
"text": [
135+
"data already exists\n"
136+
]
137+
}
138+
],
131139
"source": [
132140
"download_data()"
133141
]
@@ -142,12 +150,27 @@
142150
},
143151
{
144152
"cell_type": "code",
145-
"execution_count": null,
153+
"execution_count": 5,
146154
"id": "237823b7-e2c0-4e2f-9ee8-e3fc2b4453c4",
147155
"metadata": {
148156
"tags": []
149157
},
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+
],
151174
"source": [
152175
"# create a `Plot` instance\n",
153176
"plot = fpl.Plot(size=(600, 500))\n",
@@ -192,7 +215,7 @@
192215
},
193216
{
194217
"cell_type": "code",
195-
"execution_count": null,
218+
"execution_count": 6,
196219
"id": "de816c88-1c4a-4071-8a5e-c46c93671ef5",
197220
"metadata": {
198221
"tags": []
@@ -216,7 +239,7 @@
216239
},
217240
{
218241
"cell_type": "code",
219-
"execution_count": null,
242+
"execution_count": 7,
220243
"id": "83b2db1b-2783-4e89-bcf3-66bb6e09e18a",
221244
"metadata": {
222245
"tags": []
@@ -237,7 +260,7 @@
237260
},
238261
{
239262
"cell_type": "code",
240-
"execution_count": null,
263+
"execution_count": 8,
241264
"id": "3e298c1c-7551-4401-ade0-b9af7d2bbe23",
242265
"metadata": {
243266
"tags": []
@@ -257,7 +280,7 @@
257280
},
258281
{
259282
"cell_type": "code",
260-
"execution_count": null,
283+
"execution_count": 9,
261284
"id": "ea100318-023c-4963-b859-8c2a8fcce301",
262285
"metadata": {
263286
"tags": []
@@ -270,7 +293,7 @@
270293
},
271294
{
272295
"cell_type": "code",
273-
"execution_count": null,
296+
"execution_count": 10,
274297
"id": "a1320f9f-fff5-4b9b-9a49-0695042ab8ab",
275298
"metadata": {
276299
"tags": []
@@ -282,7 +305,7 @@
282305
},
283306
{
284307
"cell_type": "code",
285-
"execution_count": null,
308+
"execution_count": 11,
286309
"id": "4c369d3d-7219-4231-80cd-ce82b6a67a20",
287310
"metadata": {
288311
"tags": []
@@ -316,12 +339,35 @@
316339
},
317340
{
318341
"cell_type": "code",
319-
"execution_count": null,
342+
"execution_count": 12,
320343
"id": "aadd757f-6379-4f52-a709-46aa57c56216",
321344
"metadata": {
322345
"tags": []
323346
},
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+
],
325371
"source": [
326372
"# create another `Plot` instance\n",
327373
"plot_v = fpl.Plot(size=(600, 500))\n",
@@ -351,94 +397,17 @@
351397
" display(plot_v.show())"
352398
]
353399
},
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-
},
398400
{
399401
"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",
402404
"metadata": {
403405
"tags": []
404406
},
405407
"outputs": [],
406408
"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",
440409
"plot_v.close()\n",
441-
"plot_sync.close()"
410+
"sc.close()"
442411
]
443412
},
444413
{

0 commit comments

Comments
 (0)