Skip to content

finish buttons for toolbar #207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 27 commits into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7869153
working on toolbar
May 17, 2023
6a9fa9a
toolbar updates
May 18, 2023
4bab1ce
basic toolbar for plot implemented
May 19, 2023
3e916c9
base logic in notebook for gridplot toolbar
May 19, 2023
2fa309b
gp toolbar working when subplots have names & mix names/no names
May 19, 2023
b985f31
initial changes to simple plot toolbar
May 19, 2023
1702938
updates to plot toolbar, still need to refactor into separate file
May 22, 2023
20ef9dd
fixed gridplot toolbar, still need to move to separate class
May 22, 2023
47612a4
add flip button
May 22, 2023
14fda3c
adding click event handler for gp toolbar dropdown options
May 23, 2023
5bb9f00
keep new clicked plot up-to-date with toggle button values
May 23, 2023
7519116
Merge branch 'master' into buttons
clewis7 May 23, 2023
561b4eb
requested changes
May 23, 2023
0eacf45
Merge branch 'buttons' of https://github.com/kushalkolar/fastplotlib …
May 23, 2023
1fffdf1
adding record button
May 23, 2023
48775c3
record button
May 24, 2023
b125530
Merge branch 'master' into more_buttons
clewis7 May 24, 2023
9e6ed71
silly miss in merge conflict resolve
May 24, 2023
2b59076
wow I am struggling this am
May 24, 2023
9bdd2f7
imagewidget toolbar for single plot iw
May 24, 2023
edc1ab3
toolbar for iw with gridplot
May 24, 2023
3dc010e
requested changes
May 25, 2023
039d142
update flip icon
May 25, 2023
539b45a
toolbar updates
May 25, 2023
5778dd5
changes to linear selector event handler removal
May 25, 2023
0bbe464
Update fastplotlib/widgets/image.py
kushalkolar Jun 2, 2023
480e67f
simplify toolbar stuff in show(), simplify image widget toolbar
kushalkolar Jun 2, 2023
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
228 changes: 176 additions & 52 deletions examples/buttons.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,28 @@
"cell_type": "code",
"execution_count": 1,
"id": "6725ce7d-eea7-44f7-bedc-813e8ce5bf4f",
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"from fastplotlib import Plot\n",
"from ipywidgets import HBox, Checkbox, Image, VBox, Layout, ToggleButton, Button\n",
"from fastplotlib import Plot, GridPlot, ImageWidget\n",
"from ipywidgets import HBox, Checkbox, Image, VBox, Layout, ToggleButton, Button, Dropdown\n",
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "33bf59c4-14e5-43a8-8a16-69b6859864c5",
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "95be7ab3326347359f783946ec8d9339",
"model_id": "5039947949ac4d5da76e561e082da8c2",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -36,14 +40,14 @@
"name": "stderr",
"output_type": "stream",
"text": [
"/home/clewis7/repos/fastplotlib/fastplotlib/graphics/features/_base.py:33: UserWarning: converting float64 array to float32\n",
"/home/clewis7/repos/fastplotlib/fastplotlib/graphics/features/_base.py:34: UserWarning: converting float64 array to float32\n",
" warn(f\"converting {array.dtype} array to float32\")\n"
]
},
{
"data": {
"text/plain": [
"<weakproxy at 0x7f125aa1ae00 to LineGraphic at 0x7f125aa50f10>"
"<weakproxy at 0x7ff6ca7af970 to LineGraphic at 0x7ff6ca7f0290>"
]
},
"execution_count": 2,
Expand All @@ -64,12 +68,14 @@
"cell_type": "code",
"execution_count": 3,
"id": "68ea8011-d6fd-448f-9bf6-34073164d271",
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "cecbc6a1fec54d03876ac5a8609e5200",
"model_id": "5819995040a04300b5ccf10abac8b69e",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -89,24 +95,15 @@
{
"cell_type": "code",
"execution_count": 4,
"id": "0bbb459c-cb49-448e-b0b8-c541e55da313",
"metadata": {},
"outputs": [],
"source": [
"from fastplotlib import GridPlot\n",
"from ipywidgets import Dropdown"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "91a31531-818b-46a2-9587-5d9ef5b59b93",
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "05c6d9d2f62846e8ab6135a3d218964c",
"model_id": "2f318829d0a4419798a008c5fe2d6677",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -126,9 +123,11 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 5,
"id": "e96bbda7-3693-42f2-bd52-f668f39134f6",
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"img = np.random.rand(512,512)\n",
Expand All @@ -138,22 +137,24 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 6,
"id": "03b877ba-cf9c-47d9-a0e5-b3e694274a28",
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "9b792858ff24411db756810bb8eea00f",
"model_id": "ff5064077bb944c6a5248f135f052668",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(JupyterWgpuCanvas(), HBox(children=(Button(icon='expand-arrows-alt', layout=Layout(width='auto'…"
]
},
"execution_count": 7,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -162,16 +163,63 @@
"gp.show()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "36f5e040-cc58-4b0a-beb1-1f66ea02ccb9",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "f21de0c607b24fd281364a7bec8ad837",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"RFBOutputContext()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"gp2 = GridPlot(shape=(1,2))"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "c6753d45-a0ae-4c96-8ed5-7638c4cf24e3",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"for subplot in gp2:\n",
" subplot.add_image(data=img)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "afc0cd52-fb24-4561-9876-50fbdf784502",
"metadata": {},
"id": "5a769c0f-6d95-4969-ad9d-24636fc74b18",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "fcb816a9aaab42b3a7a7e443607ad127",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"(0, 1)"
"VBox(children=(JupyterWgpuCanvas(), HBox(children=(Button(icon='expand-arrows-alt', layout=Layout(width='auto'…"
]
},
"execution_count": 9,
Expand All @@ -180,19 +228,33 @@
}
],
"source": [
"gp[0,1].position"
"gp2.show()"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "36f5e040-cc58-4b0a-beb1-1f66ea02ccb9",
"metadata": {},
"execution_count": 2,
"id": "3958829a-1a2b-4aa2-8c9d-408dce9ccf30",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"data = np.random.rand(500, 512, 512)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "9f60c0b0-d0ee-4ea1-b961-708aff3b91ae",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "f902391ceb614f2a812725371184ce81",
"model_id": "433485ec12b44aa68082a93c264e613c",
"version_major": 2,
"version_minor": 0
},
Expand All @@ -202,53 +264,115 @@
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/clewis7/repos/fastplotlib/fastplotlib/graphics/features/_base.py:34: UserWarning: converting float64 array to float32\n",
" warn(f\"converting {array.dtype} array to float32\")\n"
]
}
],
"source": [
"gp2 = GridPlot(shape=(1,2))"
"iw = ImageWidget(data=data, vmin_vmax_sliders=True)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "c6753d45-a0ae-4c96-8ed5-7638c4cf24e3",
"metadata": {},
"outputs": [],
"execution_count": 4,
"id": "346f241c-4bd0-4f90-afd5-3fa617d96dad",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a1bdd59532f240948d33ae440d61c4a5",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(VBox(children=(JupyterWgpuCanvas(), HBox(children=(Button(icon='expand-arrows-alt', layout=Layo…"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"for subplot in gp2:\n",
" subplot.add_image(data=img)"
"iw.show()"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "5a769c0f-6d95-4969-ad9d-24636fc74b18",
"metadata": {},
"execution_count": 5,
"id": "0563ddfb-8fd3-4a99-bcee-3a83ae5d0f32",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "65a2a30036f44e22a479c6edd215e25a",
"model_id": "79e924078e7f4cf69be71eaf12a94854",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(JupyterWgpuCanvas(), HBox(children=(Button(icon='expand-arrows-alt', layout=Layout(width='auto'…"
"RFBOutputContext()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"iw2 = ImageWidget(data=[data, data, data, data], grid_plot_kwargs={'controllers': np.array([[0, 1], [2, 3]])}, slider_dims=\"t\", vmin_vmax_sliders=True)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "d7fb94f8-825f-4447-b161-c9dafa1a068a",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "bb3b7dd92b4d4f74ace4adfbca35aaf3",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(VBox(children=(JupyterWgpuCanvas(), HBox(children=(Button(icon='expand-arrows-alt', layout=Layo…"
]
},
"execution_count": 10,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"gp2.show()"
"iw2.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "cd3e7b3c-f4d2-44c7-931c-d172c7bdad36",
"id": "3743219d-6702-468a-bea6-0e4c4549e9e4",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "68bafb86-db5a-4681-8176-37ec72ce04a8",
"metadata": {},
"outputs": [],
"source": []
Expand All @@ -270,7 +394,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.2"
"version": "3.11.3"
}
},
"nbformat": 4,
Expand Down
Loading