|
2 | 2 | "cells": [ |
3 | 3 | { |
4 | 4 | "cell_type": "markdown", |
5 | | - "id": "40bf515f-7ca3-4f16-8ec9-31076e8d4bde", |
| 5 | + "id": "1db50ec4-8754-4421-9f5e-6ba8ca6b81e3", |
6 | 6 | "metadata": {}, |
7 | 7 | "source": [ |
8 | 8 | "# `LinearRegionSelector` with single lines" |
|
11 | 11 | { |
12 | 12 | "cell_type": "code", |
13 | 13 | "execution_count": null, |
14 | | - "id": "41f4e1d0-9ae9-4e59-9883-d9339d985afe", |
15 | | - "metadata": { |
16 | | - "tags": [] |
17 | | - }, |
| 14 | + "id": "b7bbfeb4-1ad0-47db-9a82-3d3f642a1f63", |
| 15 | + "metadata": {}, |
18 | 16 | "outputs": [], |
19 | 17 | "source": [ |
20 | 18 | "import fastplotlib as fpl\n", |
|
83 | 81 | "ls_x.selection.add_event_handler(set_zoom_x)\n", |
84 | 82 | "ls_y.selection.add_event_handler(set_zoom_y)\n", |
85 | 83 | "\n", |
86 | | - "# make some ipywidget sliders too\n", |
87 | | - "# these are not necessary, it's just to show how they can be connected\n", |
88 | | - "x_range_slider = IntRangeSlider(\n", |
89 | | - " value=ls_x.selection(),\n", |
90 | | - " min=ls_x.limits[0],\n", |
91 | | - " max=ls_x.limits[1],\n", |
92 | | - " description=\"x\"\n", |
93 | | - ")\n", |
94 | | - "\n", |
95 | | - "y_range_slider = FloatRangeSlider(\n", |
96 | | - " value=ls_y.selection(),\n", |
97 | | - " min=ls_y.limits[0],\n", |
98 | | - " max=ls_y.limits[1],\n", |
99 | | - " description=\"x\"\n", |
100 | | - ")\n", |
101 | | - "\n", |
102 | | - "# connect the region selector to the ipywidget slider\n", |
103 | | - "ls_x.add_ipywidget_handler(x_range_slider, step=5)\n", |
104 | | - "ls_y.add_ipywidget_handler(y_range_slider, step=0.1)\n", |
105 | | - "\n", |
106 | | - "VBox([gp.show(), x_range_slider, y_range_slider])" |
| 84 | + "gp.show()" |
107 | 85 | ] |
108 | 86 | }, |
109 | 87 | { |
110 | 88 | "cell_type": "markdown", |
111 | | - "id": "66b1c599-42c0-4223-b33e-37c1ef077204", |
| 89 | + "id": "0bad4a35-f860-4f85-9061-920154ab682b", |
112 | 90 | "metadata": {}, |
113 | 91 | "source": [ |
114 | 92 | "### 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." |
|
117 | 95 | { |
118 | 96 | "cell_type": "code", |
119 | 97 | "execution_count": null, |
120 | | - "id": "8b26a37d-aa1d-478e-ad77-99f68a2b7d0c", |
121 | | - "metadata": { |
122 | | - "tags": [] |
123 | | - }, |
| 98 | + "id": "2c96a3ff-c2e7-4683-8097-8491e97dd6d3", |
| 99 | + "metadata": {}, |
124 | 100 | "outputs": [], |
125 | 101 | "source": [ |
126 | 102 | "ls_x.selection()" |
|
129 | 105 | { |
130 | 106 | "cell_type": "code", |
131 | 107 | "execution_count": null, |
132 | | - "id": "c2be060c-8f87-4b5c-8262-619768f6e6af", |
133 | | - "metadata": { |
134 | | - "tags": [] |
135 | | - }, |
| 108 | + "id": "3ec71e3f-291c-43c6-a954-0a082ba5981c", |
| 109 | + "metadata": {}, |
136 | 110 | "outputs": [], |
137 | 111 | "source": [ |
138 | 112 | "ls_x.get_selected_indices()" |
139 | 113 | ] |
140 | 114 | }, |
141 | 115 | { |
142 | 116 | "cell_type": "markdown", |
143 | | - "id": "d1bef432-d764-4841-bd6d-9b9e4c86ff62", |
| 117 | + "id": "1588a89e-1da4-4ada-92e2-7437ba942065", |
144 | 118 | "metadata": {}, |
145 | 119 | "source": [ |
146 | 120 | "### 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." |
|
149 | 123 | { |
150 | 124 | "cell_type": "code", |
151 | 125 | "execution_count": null, |
152 | | - "id": "c370d6d7-d92a-4680-8bf0-2f9d541028be", |
153 | | - "metadata": { |
154 | | - "tags": [] |
155 | | - }, |
| 126 | + "id": "18e10277-6d5d-42fe-8715-1733efabefa0", |
| 127 | + "metadata": {}, |
156 | 128 | "outputs": [], |
157 | 129 | "source": [ |
158 | 130 | "ls_y.selection()" |
|
161 | 133 | { |
162 | 134 | "cell_type": "code", |
163 | 135 | "execution_count": null, |
164 | | - "id": "cdf351e1-63a2-4f5a-8199-8ac3f70909c1", |
165 | | - "metadata": { |
166 | | - "tags": [] |
167 | | - }, |
| 136 | + "id": "8e9c42b9-60d2-4544-96c5-c8c6832b79e3", |
| 137 | + "metadata": {}, |
168 | 138 | "outputs": [], |
169 | 139 | "source": [ |
170 | 140 | "ls_y.get_selected_indices()" |
|
173 | 143 | { |
174 | 144 | "cell_type": "code", |
175 | 145 | "execution_count": null, |
176 | | - "id": "6fd608ad-9732-4f50-9d43-8630603c86d0", |
177 | | - "metadata": { |
178 | | - "tags": [] |
179 | | - }, |
| 146 | + "id": "a9583d2e-ec52-405c-a875-f3fec5e3aa16", |
| 147 | + "metadata": {}, |
180 | 148 | "outputs": [], |
181 | 149 | "source": [ |
182 | 150 | "import fastplotlib as fpl\n", |
|
224 | 192 | }, |
225 | 193 | { |
226 | 194 | "cell_type": "markdown", |
227 | | - "id": "63acd2b6-958e-458d-bf01-903037644cfe", |
| 195 | + "id": "0fa051b5-d6bc-4e4e-8f12-44f638a00c88", |
228 | 196 | "metadata": {}, |
229 | 197 | "source": [ |
230 | 198 | "# Large line stack with selector" |
|
233 | 201 | { |
234 | 202 | "cell_type": "code", |
235 | 203 | "execution_count": null, |
236 | | - "id": "20e53223-6ccd-4145-bf67-32eb409d3b0a", |
237 | | - "metadata": { |
238 | | - "tags": [] |
239 | | - }, |
| 204 | + "id": "d5ffb678-c989-49ee-85a9-4fd7822f033c", |
| 205 | + "metadata": {}, |
240 | 206 | "outputs": [], |
241 | 207 | "source": [ |
242 | 208 | "import fastplotlib as fpl\n", |
|
279 | 245 | { |
280 | 246 | "cell_type": "code", |
281 | 247 | "execution_count": null, |
282 | | - "id": "80e276ba-23b3-43d0-9e0c-86acab79ac67", |
| 248 | + "id": "cbcd6309-fb47-4941-9fd1-2b091feb3ae7", |
283 | 249 | "metadata": {}, |
284 | 250 | "outputs": [], |
285 | 251 | "source": [] |
|
301 | 267 | "name": "python", |
302 | 268 | "nbconvert_exporter": "python", |
303 | 269 | "pygments_lexer": "ipython3", |
304 | | - "version": "3.11.4" |
| 270 | + "version": "3.11.3" |
305 | 271 | } |
306 | 272 | }, |
307 | 273 | "nbformat": 4, |
|
0 commit comments