Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 57e0fe9

Browse filesBrowse files
committed
update demo nbs
1 parent 7943697 commit 57e0fe9
Copy full SHA for 57e0fe9

File tree

Expand file treeCollapse file tree

3 files changed

+35
-113
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+35
-113
lines changed

‎examples/notebooks/image_widget.ipynb

Copy file name to clipboardExpand all lines: examples/notebooks/image_widget.ipynb
+17-27Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,8 @@
5151
{
5252
"cell_type": "code",
5353
"execution_count": null,
54-
"id": "8264fd19-661f-4c50-bdb4-d3998ffd5ff5",
55-
"metadata": {
56-
"tags": []
57-
},
54+
"id": "cc90aff2-4e56-4020-93d0-94e81f030f45",
55+
"metadata": {},
5856
"outputs": [],
5957
"source": [
6058
"iw.show()"
@@ -109,7 +107,7 @@
109107
},
110108
"outputs": [],
111109
"source": [
112-
"iw = ImageWidget(\n",
110+
"iw2 = ImageWidget(\n",
113111
" data=a, \n",
114112
" slider_dims=[\"t\"],\n",
115113
" cmap=\"gnuplot2\"\n",
@@ -125,7 +123,7 @@
125123
},
126124
"outputs": [],
127125
"source": [
128-
"iw.show()"
126+
"iw2.show()"
129127
]
130128
},
131129
{
@@ -148,7 +146,7 @@
148146
"outputs": [],
149147
"source": [
150148
"# must be in the form of {dim: (func, window_size)}\n",
151-
"iw.window_funcs = {\"t\": (np.mean, 13)}"
149+
"iw2.window_funcs = {\"t\": (np.mean, 13)}"
152150
]
153151
},
154152
{
@@ -161,7 +159,7 @@
161159
"outputs": [],
162160
"source": [
163161
"# change the winow size\n",
164-
"iw.window_funcs[\"t\"].window_size = 23"
162+
"iw2.window_funcs[\"t\"].window_size = 23"
165163
]
166164
},
167165
{
@@ -174,7 +172,7 @@
174172
"outputs": [],
175173
"source": [
176174
"# change the function\n",
177-
"iw.window_funcs[\"t\"].func = np.max"
175+
"iw2.window_funcs[\"t\"].func = np.max"
178176
]
179177
},
180178
{
@@ -187,7 +185,7 @@
187185
"outputs": [],
188186
"source": [
189187
"# or set it again\n",
190-
"iw.window_funcs = {\"t\": (np.min, 11)}"
188+
"iw2.window_funcs = {\"t\": (np.min, 11)}"
191189
]
192190
},
193191
{
@@ -208,7 +206,7 @@
208206
"outputs": [],
209207
"source": [
210208
"new_data = np.random.rand(500, 512, 512)\n",
211-
"iw.set_data(new_data=new_data)"
209+
"iw2.set_data(new_data=new_data)"
212210
]
213211
},
214212
{
@@ -241,7 +239,7 @@
241239
},
242240
"outputs": [],
243241
"source": [
244-
"iw = ImageWidget(\n",
242+
"iw3 = ImageWidget(\n",
245243
" data=data, \n",
246244
" slider_dims=[\"t\"], \n",
247245
" # dims_order=\"txy\", # you can set this manually if dim order is not the usual\n",
@@ -268,7 +266,7 @@
268266
},
269267
"outputs": [],
270268
"source": [
271-
"iw.show()"
269+
"iw3.show()"
272270
]
273271
},
274272
{
@@ -288,7 +286,7 @@
288286
},
289287
"outputs": [],
290288
"source": [
291-
"iw.gridplot[\"two\"]"
289+
"iw3.gridplot[\"two\"]"
292290
]
293291
},
294292
{
@@ -308,7 +306,7 @@
308306
},
309307
"outputs": [],
310308
"source": [
311-
"iw.window_funcs[\"t\"].func = np.max"
309+
"iw3.window_funcs[\"t\"].func = np.max"
312310
]
313311
},
314312
{
@@ -331,7 +329,7 @@
331329
"dims = (256, 256, 5, 100)\n",
332330
"data = [np.random.rand(*dims) for i in range(4)]\n",
333331
"\n",
334-
"iw = ImageWidget(\n",
332+
"iw4 = ImageWidget(\n",
335333
" data=data, \n",
336334
" slider_dims=[\"t\", \"z\"], \n",
337335
" dims_order=\"xyzt\", # example of how you can set this for non-standard orders\n",
@@ -350,7 +348,7 @@
350348
},
351349
"outputs": [],
352350
"source": [
353-
"iw.show()"
351+
"iw4.show()"
354352
]
355353
},
356354
{
@@ -370,16 +368,8 @@
370368
},
371369
"outputs": [],
372370
"source": [
373-
"iw.window_funcs = {\"t\": (np.mean, 11)}"
371+
"iw4.window_funcs = {\"t\": (np.mean, 11)}"
374372
]
375-
},
376-
{
377-
"cell_type": "code",
378-
"execution_count": null,
379-
"id": "3090a7e2-558e-4975-82f4-6a67ae141900",
380-
"metadata": {},
381-
"outputs": [],
382-
"source": []
383373
}
384374
],
385375
"metadata": {
@@ -398,7 +388,7 @@
398388
"name": "python",
399389
"nbconvert_exporter": "python",
400390
"pygments_lexer": "ipython3",
401-
"version": "3.11.2"
391+
"version": "3.11.3"
402392
}
403393
},
404394
"nbformat": 4,

‎examples/notebooks/linear_selector.ipynb

Copy file name to clipboardExpand all lines: examples/notebooks/linear_selector.ipynb
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"selector3.add_ipywidget_handler(ipywidget_slider3, step=0.1)\n",
5858
"\n",
5959
"plot.auto_scale()\n",
60-
"plot.show(vbox=[ipywidget_slider])"
60+
"plot.show(add_widgets=[ipywidget_slider])"
6161
]
6262
},
6363
{

‎examples/notebooks/simple.ipynb

Copy file name to clipboardExpand all lines: examples/notebooks/simple.ipynb
+17-85Lines changed: 17 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -110,19 +110,7 @@
110110
"source": [
111111
"**Use the handle on the bottom right corner of the _canvas_ to resize it. You can also pan and zoom using your mouse!**\n",
112112
"\n",
113-
"By default the origin is on the bottom left, you can click the flip button to flip the y-axis, or use `plot.camera.local.scale_y *= -1`"
114-
]
115-
},
116-
{
117-
"cell_type": "code",
118-
"execution_count": null,
119-
"id": "58c1dc0b-9bf0-4ad5-8579-7c10396fc6bc",
120-
"metadata": {
121-
"tags": []
122-
},
123-
"outputs": [],
124-
"source": [
125-
"plot.camera.local.scale_y *= -1"
113+
"If an image is in the plot the origin is in the top left. You can click the flip button to flip the y-axis direction, or use `plot.camera.local.scale_y *= -1`"
126114
]
127115
},
128116
{
@@ -450,8 +438,8 @@
450438
"metadata": {},
451439
"outputs": [],
452440
"source": [
453-
"# close the sidecar\n",
454-
"plot.sidecar.close()"
441+
"# close the plot\n",
442+
"plot.close()"
455443
]
456444
},
457445
{
@@ -481,18 +469,6 @@
481469
"plot_rgb.show()"
482470
]
483471
},
484-
{
485-
"cell_type": "code",
486-
"execution_count": null,
487-
"id": "71eae361-3bbf-4d1f-a903-3615d35b557b",
488-
"metadata": {
489-
"tags": []
490-
},
491-
"outputs": [],
492-
"source": [
493-
"plot_rgb.camera.local.scale_y *= -1"
494-
]
495-
},
496472
{
497473
"cell_type": "markdown",
498474
"id": "7fc66377-00e8-4f32-9671-9cf63f74529f",
@@ -533,8 +509,8 @@
533509
"metadata": {},
534510
"outputs": [],
535511
"source": [
536-
"# close sidecar\n",
537-
"plot_rgb.sidecar.close()"
512+
"# close plot\n",
513+
"plot_rgb.close()"
538514
]
539515
},
540516
{
@@ -632,24 +608,14 @@
632608
"### You can also use `ipywidgets.VBox` and `HBox` to stack plots. See the `gridplot` notebooks for a proper gridplot interface for more automated subplotting"
633609
]
634610
},
635-
{
636-
"cell_type": "code",
637-
"execution_count": null,
638-
"id": "ef9743b3-5f81-4b79-9502-fa5fca08e56d",
639-
"metadata": {},
640-
"outputs": [],
641-
"source": [
642-
"VBox([plot_v.show(sidecar=False), plot_sync.show(sidecar=False)])"
643-
]
644-
},
645611
{
646612
"cell_type": "code",
647613
"execution_count": null,
648614
"id": "11839d95-8ff7-444c-ae13-6b072c3112c5",
649615
"metadata": {},
650616
"outputs": [],
651617
"source": [
652-
"HBox([plot_v.show(sidecar=False), plot_sync.show(sidecar=False)])"
618+
"HBox([plot_v.show(), plot_sync.show()])"
653619
]
654620
},
655621
{
@@ -659,8 +625,9 @@
659625
"metadata": {},
660626
"outputs": [],
661627
"source": [
662-
"# close sidecar\n",
663-
"plot_v.sidecar.close()"
628+
"# close plot\n",
629+
"plot_v.close()\n",
630+
"plot_sync.close()"
664631
]
665632
},
666633
{
@@ -762,19 +729,7 @@
762729
"\n",
763730
"Set `maintain_aspect = False` on a camera, and then use the right mouse button and move the mouse to stretch and squeeze the view!\n",
764731
"\n",
765-
"You can also click the **`1:1`** button to toggle this."
766-
]
767-
},
768-
{
769-
"cell_type": "code",
770-
"execution_count": null,
771-
"id": "2695f023-f6ce-4e26-8f96-4fbed5510d1d",
772-
"metadata": {
773-
"tags": []
774-
},
775-
"outputs": [],
776-
"source": [
777-
"plot_l.camera.maintain_aspect = False"
732+
"You can also click the **`1:1`** button to toggle this, or use `plot.camera.maintain_aspect`"
778733
]
779734
},
780735
{
@@ -877,7 +832,7 @@
877832
"id": "c29f81f9-601b-49f4-b20c-575c56e58026",
878833
"metadata": {},
879834
"source": [
880-
"## Graphic _data_ is itself also indexable"
835+
"## Graphic _data_ is also indexable"
881836
]
882837
},
883838
{
@@ -1027,8 +982,8 @@
1027982
"metadata": {},
1028983
"outputs": [],
1029984
"source": [
1030-
"# close sidecar\n",
1031-
"plot_l.sidecar.close()"
985+
"# close plot\n",
986+
"plot_l.close()"
1032987
]
1033988
},
1034989
{
@@ -1099,8 +1054,8 @@
10991054
},
11001055
"outputs": [],
11011056
"source": [
1102-
"# close sidecar\n",
1103-
"plot_l3d.sidecar.close()"
1057+
"# close plot\n",
1058+
"plot_l3d.close()"
11041059
]
11051060
},
11061061
{
@@ -1239,31 +1194,8 @@
12391194
"metadata": {},
12401195
"outputs": [],
12411196
"source": [
1242-
"# close sidecar\n",
1243-
"plot_s.sidecar.close()"
1244-
]
1245-
},
1246-
{
1247-
"cell_type": "markdown",
1248-
"id": "d9e554de-c436-4684-a46a-ce8a33d409ac",
1249-
"metadata": {},
1250-
"source": [
1251-
"### You can combine VBox and HBox to create more complex layouts\n",
1252-
"\n",
1253-
"This just plots everything above in a single nb output"
1254-
]
1255-
},
1256-
{
1257-
"cell_type": "code",
1258-
"execution_count": null,
1259-
"id": "f404a5ea-633b-43f5-87d1-237017bbca2a",
1260-
"metadata": {},
1261-
"outputs": [],
1262-
"source": [
1263-
"row1 = HBox([plot.show(sidecar=False), plot_v.show(sidecar=False), plot_sync.show(sidecar=False)])\n",
1264-
"row2 = HBox([plot_l.show(sidecar=False), plot_l3d.show(sidecar=False), plot_s.show(sidecar=False)])\n",
1265-
"\n",
1266-
"VBox([row1, row2])"
1197+
"# close plot\n",
1198+
"plot_s.close()"
12671199
]
12681200
},
12691201
{

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.