diff --git a/docs/api-reference/index.md b/docs/api-reference/index.md index 283dd036..73b7c944 100644 --- a/docs/api-reference/index.md +++ b/docs/api-reference/index.md @@ -61,6 +61,7 @@ widgets.Box widgets.Checkboxes widgets.HBar + widgets.RangeSliceWidget widgets.SliceWidget widgets.VBar diff --git a/docs/gallery/scatter3d-with-slider.ipynb b/docs/gallery/scatter3d-with-slider.ipynb index 98e74bed..e3092c08 100644 --- a/docs/gallery/scatter3d-with-slider.ipynb +++ b/docs/gallery/scatter3d-with-slider.ipynb @@ -29,6 +29,8 @@ "id": "f99ea04f-3b3b-49df-b4a2-99aa9bd8090a", "metadata": {}, "source": [ + "## Generate data on a curved panel\n", + "\n", "We first generate some data that represents events detected on a cylindrical detector panel,\n", "as a function of time." ] @@ -74,6 +76,8 @@ "id": "604b3530-76e0-4fb0-88b3-a731ffb5a162", "metadata": {}, "source": [ + "## A slider selecting a single data slice\n", + "\n", "We then construct our interface with a slider,\n", "a node that slices our data at the index of the slider,\n", "and a `scatter3dfigure`." @@ -100,6 +104,16 @@ "pp.widgets.Box([fig, slider])" ] }, + { + "cell_type": "markdown", + "id": "caaa6846-e5b4-4179-9b48-bfb15692dde4", + "metadata": {}, + "source": [ + "## A slider slicing out a range\n", + "\n", + "It is also possible to use a `RangeSliceWidget` to create a slider with two handles that selects a data range instead of slicing using a single index:" + ] + }, { "cell_type": "code", "execution_count": null, @@ -111,9 +125,9 @@ "slider = pw.RangeSliceWidget(da, dims=['time'])\n", "slider_node = pp.widget_node(slider)\n", "\n", - "# Sum over the selected range of time dimension\n", "slice_node = pw.slice_dims(data_array=da, slices=slider_node)\n", "\n", + "# Sum over the selected range of time dimension\n", "sum_slices = pp.Node(sc.sum, slice_node, dim='time')\n", "\n", "fig = pp.scatter3dfigure(sum_slices, pixel_size=0.3)\n", @@ -150,8 +164,7 @@ "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.8" + "pygments_lexer": "ipython3" } }, "nbformat": 4,