Debian Codegraph @

ui-tests/tests/notebooks/index_selector_update.ipynb

raw
1 {
2 "cells": [
3 {
4 "cell_type": "code",
5 "execution_count": null,
6 "id": "06ac2448-da47-4939-a22a-e4b556fba103",
7 "metadata": {},
8 "outputs": [],
9 "source": [
10 "from bqplot import *\n",
11 "from bqplot.interacts import *\n",
12 "\n",
13 "# Create Scatter\n",
14 "sc_x = LinearScale()\n",
15 "sc_y = LinearScale()\n",
16 "\n",
17 "scatt = Scatter(\n",
18 " x=list(range(10)), \n",
19 " y=[20, 3, 23, 5, 6, 12, 23, 14, 20, 3],\n",
20 " scales={'x': sc_x, 'y': sc_y},\n",
21 " selected_style={\"opacity\": \"1\"},\n",
22 " unselected_style={\"opacity\": \"0.2\"}\n",
23 ")\n",
24 "\n",
25 "sel = IndexSelector(\n",
26 " marks=[scatt], \n",
27 " scale=sc_x,\n",
28 " selected=3\n",
29 ")\n",
30 "\n",
31 "ax_x = Axis(scale=sc_x)\n",
32 "ax_y = Axis(scale=sc_y, orientation='vertical')\n",
33 "\n",
34 "fig = Figure(\n",
35 " marks=[scatt], \n",
36 " axes=[ax_x, ax_y],\n",
37 " interaction=sel\n",
38 ")\n",
39 "fig"
40 ]
41 },
42 {
43 "cell_type": "code",
44 "execution_count": null,
45 "id": "a0600d9f-2256-4610-a14e-471c255d4924",
46 "metadata": {},
47 "outputs": [],
48 "source": [
49 "sel.selected = 5"
50 ]
51 }
52 ],
53 "metadata": {
54 "kernelspec": {
55 "display_name": "Python 3 (ipykernel)",
56 "language": "python",
57 "name": "python3"
58 },
59 "language_info": {
60 "codemirror_mode": {
61 "name": "ipython",
62 "version": 3
63 },
64 "file_extension": ".py",
65 "mimetype": "text/x-python",
66 "name": "python",
67 "nbconvert_exporter": "python",
68 "pygments_lexer": "ipython3",
69 "version": "3.10.0"
70 }
71 },
72 "nbformat": 4,
73 "nbformat_minor": 5
74 }