Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/gridplot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/image_cmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/image_rgb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/image_rgbvminvmax.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/image_simple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/desktop/screenshots/image_vminvmax.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 17 additions & 27 deletions examples/notebooks/image_widget.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "8264fd19-661f-4c50-bdb4-d3998ffd5ff5",
"metadata": {
"tags": []
},
"id": "cc90aff2-4e56-4020-93d0-94e81f030f45",
"metadata": {},
"outputs": [],
"source": [
"iw.show()"
Expand Down Expand Up @@ -109,7 +107,7 @@
},
"outputs": [],
"source": [
"iw = ImageWidget(\n",
"iw2 = ImageWidget(\n",
" data=a, \n",
" slider_dims=[\"t\"],\n",
" cmap=\"gnuplot2\"\n",
Expand All @@ -125,7 +123,7 @@
},
"outputs": [],
"source": [
"iw.show()"
"iw2.show()"
]
},
{
Expand All @@ -148,7 +146,7 @@
"outputs": [],
"source": [
"# must be in the form of {dim: (func, window_size)}\n",
"iw.window_funcs = {\"t\": (np.mean, 13)}"
"iw2.window_funcs = {\"t\": (np.mean, 13)}"
]
},
{
Expand All @@ -161,7 +159,7 @@
"outputs": [],
"source": [
"# change the winow size\n",
"iw.window_funcs[\"t\"].window_size = 23"
"iw2.window_funcs[\"t\"].window_size = 23"
]
},
{
Expand All @@ -174,7 +172,7 @@
"outputs": [],
"source": [
"# change the function\n",
"iw.window_funcs[\"t\"].func = np.max"
"iw2.window_funcs[\"t\"].func = np.max"
]
},
{
Expand All @@ -187,7 +185,7 @@
"outputs": [],
"source": [
"# or set it again\n",
"iw.window_funcs = {\"t\": (np.min, 11)}"
"iw2.window_funcs = {\"t\": (np.min, 11)}"
]
},
{
Expand All @@ -208,7 +206,7 @@
"outputs": [],
"source": [
"new_data = np.random.rand(500, 512, 512)\n",
"iw.set_data(new_data=new_data)"
"iw2.set_data(new_data=new_data)"
]
},
{
Expand Down Expand Up @@ -241,7 +239,7 @@
},
"outputs": [],
"source": [
"iw = ImageWidget(\n",
"iw3 = ImageWidget(\n",
" data=data, \n",
" slider_dims=[\"t\"], \n",
" # dims_order=\"txy\", # you can set this manually if dim order is not the usual\n",
Expand All @@ -268,7 +266,7 @@
},
"outputs": [],
"source": [
"iw.show()"
"iw3.show()"
]
},
{
Expand All @@ -288,7 +286,7 @@
},
"outputs": [],
"source": [
"iw.gridplot[\"two\"]"
"iw3.gridplot[\"two\"]"
]
},
{
Expand All @@ -308,7 +306,7 @@
},
"outputs": [],
"source": [
"iw.window_funcs[\"t\"].func = np.max"
"iw3.window_funcs[\"t\"].func = np.max"
]
},
{
Expand All @@ -331,7 +329,7 @@
"dims = (256, 256, 5, 100)\n",
"data = [np.random.rand(*dims) for i in range(4)]\n",
"\n",
"iw = ImageWidget(\n",
"iw4 = ImageWidget(\n",
" data=data, \n",
" slider_dims=[\"t\", \"z\"], \n",
" dims_order=\"xyzt\", # example of how you can set this for non-standard orders\n",
Expand All @@ -350,7 +348,7 @@
},
"outputs": [],
"source": [
"iw.show()"
"iw4.show()"
]
},
{
Expand All @@ -370,16 +368,8 @@
},
"outputs": [],
"source": [
"iw.window_funcs = {\"t\": (np.mean, 11)}"
"iw4.window_funcs = {\"t\": (np.mean, 11)}"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3090a7e2-558e-4975-82f4-6a67ae141900",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -398,7 +388,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.2"
"version": "3.11.3"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion examples/notebooks/linear_selector.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"selector3.add_ipywidget_handler(ipywidget_slider3, step=0.1)\n",
"\n",
"plot.auto_scale()\n",
"plot.show(vbox=[ipywidget_slider])"
"plot.show(add_widgets=[ipywidget_slider])"
]
},
{
Expand Down
102 changes: 17 additions & 85 deletions examples/notebooks/simple.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,7 @@
"source": [
"**Use the handle on the bottom right corner of the _canvas_ to resize it. You can also pan and zoom using your mouse!**\n",
"\n",
"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`"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "58c1dc0b-9bf0-4ad5-8579-7c10396fc6bc",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"plot.camera.local.scale_y *= -1"
"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`"
]
},
{
Expand Down Expand Up @@ -450,8 +438,8 @@
"metadata": {},
"outputs": [],
"source": [
"# close the sidecar\n",
"plot.sidecar.close()"
"# close the plot\n",
"plot.close()"
]
},
{
Expand Down Expand Up @@ -481,18 +469,6 @@
"plot_rgb.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "71eae361-3bbf-4d1f-a903-3615d35b557b",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"plot_rgb.camera.local.scale_y *= -1"
]
},
{
"cell_type": "markdown",
"id": "7fc66377-00e8-4f32-9671-9cf63f74529f",
Expand Down Expand Up @@ -533,8 +509,8 @@
"metadata": {},
"outputs": [],
"source": [
"# close sidecar\n",
"plot_rgb.sidecar.close()"
"# close plot\n",
"plot_rgb.close()"
]
},
{
Expand Down Expand Up @@ -632,24 +608,14 @@
"### You can also use `ipywidgets.VBox` and `HBox` to stack plots. See the `gridplot` notebooks for a proper gridplot interface for more automated subplotting"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ef9743b3-5f81-4b79-9502-fa5fca08e56d",
"metadata": {},
"outputs": [],
"source": [
"VBox([plot_v.show(sidecar=False), plot_sync.show(sidecar=False)])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "11839d95-8ff7-444c-ae13-6b072c3112c5",
"metadata": {},
"outputs": [],
"source": [
"HBox([plot_v.show(sidecar=False), plot_sync.show(sidecar=False)])"
"HBox([plot_v.show(), plot_sync.show()])"
]
},
{
Expand All @@ -659,8 +625,9 @@
"metadata": {},
"outputs": [],
"source": [
"# close sidecar\n",
"plot_v.sidecar.close()"
"# close plot\n",
"plot_v.close()\n",
"plot_sync.close()"
]
},
{
Expand Down Expand Up @@ -762,19 +729,7 @@
"\n",
"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",
"\n",
"You can also click the **`1:1`** button to toggle this."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2695f023-f6ce-4e26-8f96-4fbed5510d1d",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"plot_l.camera.maintain_aspect = False"
"You can also click the **`1:1`** button to toggle this, or use `plot.camera.maintain_aspect`"
]
},
{
Expand Down Expand Up @@ -877,7 +832,7 @@
"id": "c29f81f9-601b-49f4-b20c-575c56e58026",
"metadata": {},
"source": [
"## Graphic _data_ is itself also indexable"
"## Graphic _data_ is also indexable"
]
},
{
Expand Down Expand Up @@ -1027,8 +982,8 @@
"metadata": {},
"outputs": [],
"source": [
"# close sidecar\n",
"plot_l.sidecar.close()"
"# close plot\n",
"plot_l.close()"
]
},
{
Expand Down Expand Up @@ -1099,8 +1054,8 @@
},
"outputs": [],
"source": [
"# close sidecar\n",
"plot_l3d.sidecar.close()"
"# close plot\n",
"plot_l3d.close()"
]
},
{
Expand Down Expand Up @@ -1239,31 +1194,8 @@
"metadata": {},
"outputs": [],
"source": [
"# close sidecar\n",
"plot_s.sidecar.close()"
]
},
{
"cell_type": "markdown",
"id": "d9e554de-c436-4684-a46a-ce8a33d409ac",
"metadata": {},
"source": [
"### You can combine VBox and HBox to create more complex layouts\n",
"\n",
"This just plots everything above in a single nb output"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f404a5ea-633b-43f5-87d1-237017bbca2a",
"metadata": {},
"outputs": [],
"source": [
"row1 = HBox([plot.show(sidecar=False), plot_v.show(sidecar=False), plot_sync.show(sidecar=False)])\n",
"row2 = HBox([plot_l.show(sidecar=False), plot_l3d.show(sidecar=False), plot_s.show(sidecar=False)])\n",
"\n",
"VBox([row1, row2])"
"# close plot\n",
"plot_s.close()"
]
},
{
Expand Down
Loading