Skip to content

add jupyter-sidecar as a dependency, update simple notebook #300

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 14 commits into from
Sep 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
119 changes: 67 additions & 52 deletions examples/notebooks/gridplot_simple.ipynb

Large diffs are not rendered by default.

76 changes: 21 additions & 55 deletions examples/notebooks/linear_region_selector.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "40bf515f-7ca3-4f16-8ec9-31076e8d4bde",
"id": "1db50ec4-8754-4421-9f5e-6ba8ca6b81e3",
"metadata": {},
"source": [
"# `LinearRegionSelector` with single lines"
Expand All @@ -11,10 +11,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "41f4e1d0-9ae9-4e59-9883-d9339d985afe",
"metadata": {
"tags": []
},
"id": "b7bbfeb4-1ad0-47db-9a82-3d3f642a1f63",
"metadata": {},
"outputs": [],
"source": [
"import fastplotlib as fpl\n",
Expand Down Expand Up @@ -83,32 +81,12 @@
"ls_x.selection.add_event_handler(set_zoom_x)\n",
"ls_y.selection.add_event_handler(set_zoom_y)\n",
"\n",
"# make some ipywidget sliders too\n",
"# these are not necessary, it's just to show how they can be connected\n",
"x_range_slider = IntRangeSlider(\n",
" value=ls_x.selection(),\n",
" min=ls_x.limits[0],\n",
" max=ls_x.limits[1],\n",
" description=\"x\"\n",
")\n",
"\n",
"y_range_slider = FloatRangeSlider(\n",
" value=ls_y.selection(),\n",
" min=ls_y.limits[0],\n",
" max=ls_y.limits[1],\n",
" description=\"x\"\n",
")\n",
"\n",
"# connect the region selector to the ipywidget slider\n",
"ls_x.add_ipywidget_handler(x_range_slider, step=5)\n",
"ls_y.add_ipywidget_handler(y_range_slider, step=0.1)\n",
"\n",
"VBox([gp.show(), x_range_slider, y_range_slider])"
"gp.show()"
]
},
{
"cell_type": "markdown",
"id": "66b1c599-42c0-4223-b33e-37c1ef077204",
"id": "0bad4a35-f860-4f85-9061-920154ab682b",
"metadata": {},
"source": [
"### On the x-axis we have a 1-1 mapping from the data that we have passed and the line geometry positions. So the `bounds` min max corresponds directly to the data indices."
Expand All @@ -117,10 +95,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "8b26a37d-aa1d-478e-ad77-99f68a2b7d0c",
"metadata": {
"tags": []
},
"id": "2c96a3ff-c2e7-4683-8097-8491e97dd6d3",
"metadata": {},
"outputs": [],
"source": [
"ls_x.selection()"
Expand All @@ -129,18 +105,16 @@
{
"cell_type": "code",
"execution_count": null,
"id": "c2be060c-8f87-4b5c-8262-619768f6e6af",
"metadata": {
"tags": []
},
"id": "3ec71e3f-291c-43c6-a954-0a082ba5981c",
"metadata": {},
"outputs": [],
"source": [
"ls_x.get_selected_indices()"
]
},
{
"cell_type": "markdown",
"id": "d1bef432-d764-4841-bd6d-9b9e4c86ff62",
"id": "1588a89e-1da4-4ada-92e2-7437ba942065",
"metadata": {},
"source": [
"### However, for the y-axis line we have passed a 2D array where we've used a linspace, so there is not a 1-1 mapping from the data to the line geometry positions. Use `get_selected_indices()` to get the indices of the data bounded by the current selection. In addition the position of the Graphic is not `(0, 0)`. You must use `get_selected_indices()` whenever you want the indices of the selected data."
Expand All @@ -149,10 +123,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "c370d6d7-d92a-4680-8bf0-2f9d541028be",
"metadata": {
"tags": []
},
"id": "18e10277-6d5d-42fe-8715-1733efabefa0",
"metadata": {},
"outputs": [],
"source": [
"ls_y.selection()"
Expand All @@ -161,10 +133,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "cdf351e1-63a2-4f5a-8199-8ac3f70909c1",
"metadata": {
"tags": []
},
"id": "8e9c42b9-60d2-4544-96c5-c8c6832b79e3",
"metadata": {},
"outputs": [],
"source": [
"ls_y.get_selected_indices()"
Expand All @@ -173,10 +143,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "6fd608ad-9732-4f50-9d43-8630603c86d0",
"metadata": {
"tags": []
},
"id": "a9583d2e-ec52-405c-a875-f3fec5e3aa16",
"metadata": {},
"outputs": [],
"source": [
"import fastplotlib as fpl\n",
Expand Down Expand Up @@ -224,7 +192,7 @@
},
{
"cell_type": "markdown",
"id": "63acd2b6-958e-458d-bf01-903037644cfe",
"id": "0fa051b5-d6bc-4e4e-8f12-44f638a00c88",
"metadata": {},
"source": [
"# Large line stack with selector"
Expand All @@ -233,10 +201,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "20e53223-6ccd-4145-bf67-32eb409d3b0a",
"metadata": {
"tags": []
},
"id": "d5ffb678-c989-49ee-85a9-4fd7822f033c",
"metadata": {},
"outputs": [],
"source": [
"import fastplotlib as fpl\n",
Expand Down Expand Up @@ -279,7 +245,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "80e276ba-23b3-43d0-9e0c-86acab79ac67",
"id": "cbcd6309-fb47-4941-9fd1-2b091feb3ae7",
"metadata": {},
"outputs": [],
"source": []
Expand All @@ -301,7 +267,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.3"
}
},
"nbformat": 4,
Expand Down
35 changes: 20 additions & 15 deletions examples/notebooks/linear_selector.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "e0354810-f942-4e4a-b4b9-bb8c083a314e",
"id": "a06e1fd9-47df-42a3-a76c-19e23d7b89fd",
"metadata": {},
"source": [
"## `LinearSelector`, draggable selector that can optionally associated with an ipywidget."
Expand All @@ -11,10 +11,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "d79bb7e0-90af-4459-8dcb-a7a21a89ef64",
"metadata": {
"tags": []
},
"id": "eb95ba19-14b5-4bf4-93d9-05182fa500cb",
"metadata": {},
"outputs": [],
"source": [
"import fastplotlib as fpl\n",
Expand Down Expand Up @@ -59,21 +57,30 @@
"selector3.add_ipywidget_handler(ipywidget_slider3, step=0.1)\n",
"\n",
"plot.auto_scale()\n",
"plot.show()\n",
"VBox([plot.show(), ipywidget_slider, ipywidget_slider2, ipywidget_slider3])"
"plot.show(vbox=[ipywidget_slider])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7ab9f141-f92f-4c4c-808b-97dafd64ca25",
"metadata": {},
"outputs": [],
"source": [
"selector.step = 0.1"
]
},
{
"cell_type": "markdown",
"id": "2c49cdc2-0555-410c-ae2e-da36c3bf3bf0",
"id": "3b0f448f-bbe4-4b87-98e3-093f561c216c",
"metadata": {},
"source": [
"### Drag linear selectors with the mouse, hold \"Shift\" to synchronize movement of all the selectors"
]
},
{
"cell_type": "markdown",
"id": "69057edd-7e23-41e7-a284-ac55df1df5d9",
"id": "c6f041b7-8779-46f1-8454-13cec66f53fd",
"metadata": {},
"source": [
"## Also works for line collections"
Expand All @@ -82,10 +89,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "1a3b98bd-7139-48d9-bd70-66c500cd260d",
"metadata": {
"tags": []
},
"id": "e36da217-f82a-4dfa-9556-1f4a2c7c4f1c",
"metadata": {},
"outputs": [],
"source": [
"sines = [sine] * 10\n",
Expand All @@ -109,7 +114,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "b6c2d9d6-ffe0-484c-a550-cafb44fa8465",
"id": "71ae4fca-f644-4d4f-8f32-f9d069bbc2f1",
"metadata": {},
"outputs": [],
"source": []
Expand All @@ -131,7 +136,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.11.3"
}
},
"nbformat": 4,
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy