Skip to content

Commit 09dd880

Browse files
authored
Update examples to work with bokeh 3.0 (#187)
* Replace plot_{width,height} with {width,height} * Replace widgetbox() with column() * Add `ip_slider.value = ...` to jupyter_sliders.ipynb * Refresh *.ipynb files
1 parent 560c2ed commit 09dd880

6 files changed

+49
-25
lines changed

examples/jupyter_interactors.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"metadata": {},
4545
"outputs": [],
4646
"source": [
47-
"p = figure(title=\"simple line example\", plot_height=300, plot_width=600, y_range=(-5,5),\n",
47+
"p = figure(title=\"simple line example\", width=600, height=300, y_range=(-5,5),\n",
4848
" background_fill_color='#efefef')\n",
4949
"r = p.line(x, y, color=\"#8888cc\", line_width=1.5, alpha=0.8)"
5050
]
@@ -90,7 +90,7 @@
9090
],
9191
"metadata": {
9292
"kernelspec": {
93-
"display_name": "Python 3",
93+
"display_name": "Python 3 (ipykernel)",
9494
"language": "python",
9595
"name": "python3"
9696
},
@@ -104,7 +104,7 @@
104104
"name": "python",
105105
"nbconvert_exporter": "python",
106106
"pygments_lexer": "ipython3",
107-
"version": "3.7.4"
107+
"version": "3.10.8"
108108
}
109109
},
110110
"nbformat": 4,

examples/jupyter_sliders.ipynb

+11-2
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,20 @@
5151
"source": [
5252
"bk_slider.value = 5"
5353
]
54+
},
55+
{
56+
"cell_type": "code",
57+
"execution_count": null,
58+
"metadata": {},
59+
"outputs": [],
60+
"source": [
61+
"ip_slider.value = 3"
62+
]
5463
}
5564
],
5665
"metadata": {
5766
"kernelspec": {
58-
"display_name": "Python 3",
67+
"display_name": "Python 3 (ipykernel)",
5968
"language": "python",
6069
"name": "python3"
6170
},
@@ -69,7 +78,7 @@
6978
"name": "python",
7079
"nbconvert_exporter": "python",
7180
"pygments_lexer": "ipython3",
72-
"version": "3.7.4"
81+
"version": "3.10.8"
7382
}
7483
},
7584
"nbformat": 4,

examples/jupyter_widgets.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"metadata": {},
4040
"outputs": [],
4141
"source": [
42-
"p = figure(title=\"simple line example\", plot_height=300, plot_width=600, y_range=(-5,5),\n",
42+
"p = figure(title=\"simple line example\", width=600, height=300, y_range=(-5,5),\n",
4343
" background_fill_color='#efefef')\n",
4444
"r = p.line(x, y, color=\"#8888cc\", line_width=1.5, alpha=0.8)"
4545
]
@@ -84,7 +84,7 @@
8484
],
8585
"metadata": {
8686
"kernelspec": {
87-
"display_name": "Python 3",
87+
"display_name": "Python 3 (ipykernel)",
8888
"language": "python",
8989
"name": "python3"
9090
},
@@ -98,7 +98,7 @@
9898
"name": "python",
9999
"nbconvert_exporter": "python",
100100
"pygments_lexer": "ipython3",
101-
"version": "3.7.4"
101+
"version": "3.10.8"
102102
}
103103
},
104104
"nbformat": 4,

examples/notebook_comms.ipynb

+24-9
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
"cell_type": "code",
2222
"execution_count": null,
2323
"metadata": {
24-
"collapsed": false
24+
"collapsed": false,
25+
"jupyter": {
26+
"outputs_hidden": false
27+
}
2528
},
2629
"outputs": [],
2730
"source": [
@@ -46,11 +49,14 @@
4649
"cell_type": "code",
4750
"execution_count": null,
4851
"metadata": {
49-
"collapsed": false
52+
"collapsed": false,
53+
"jupyter": {
54+
"outputs_hidden": false
55+
}
5056
},
5157
"outputs": [],
5258
"source": [
53-
"opts = dict(plot_width=250, plot_height=250, min_border=0)\n",
59+
"opts = dict(width=250, height=250, min_border=0)\n",
5460
"\n",
5561
"p1 = figure(**opts)\n",
5662
"r1 = p1.circle([1,2,3], [4,5,6], size=20)\n",
@@ -66,7 +72,10 @@
6672
"cell_type": "code",
6773
"execution_count": null,
6874
"metadata": {
69-
"collapsed": false
75+
"collapsed": false,
76+
"jupyter": {
77+
"outputs_hidden": false
78+
}
7079
},
7180
"outputs": [],
7281
"source": [
@@ -87,7 +96,10 @@
8796
"cell_type": "code",
8897
"execution_count": null,
8998
"metadata": {
90-
"collapsed": false
99+
"collapsed": false,
100+
"jupyter": {
101+
"outputs_hidden": false
102+
}
91103
},
92104
"outputs": [],
93105
"source": [
@@ -109,7 +121,10 @@
109121
"cell_type": "code",
110122
"execution_count": null,
111123
"metadata": {
112-
"collapsed": false
124+
"collapsed": false,
125+
"jupyter": {
126+
"outputs_hidden": false
127+
}
113128
},
114129
"outputs": [],
115130
"source": [
@@ -121,7 +136,7 @@
121136
],
122137
"metadata": {
123138
"kernelspec": {
124-
"display_name": "Python 3",
139+
"display_name": "Python 3 (ipykernel)",
125140
"language": "python",
126141
"name": "python3"
127142
},
@@ -135,9 +150,9 @@
135150
"name": "python",
136151
"nbconvert_exporter": "python",
137152
"pygments_lexer": "ipython3",
138-
"version": "3.6.6"
153+
"version": "3.10.8"
139154
}
140155
},
141156
"nbformat": 4,
142-
"nbformat_minor": 2
157+
"nbformat_minor": 4
143158
}

examples/server_embed.ipynb

+5-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"source": [
2626
"import numpy as np\n",
2727
"\n",
28-
"from bokeh.layouts import row, widgetbox\n",
28+
"from bokeh.layouts import column, row\n",
2929
"from bokeh.models import ColumnDataSource\n",
3030
"from bokeh.models.widgets import Slider, TextInput\n",
3131
"from bokeh.plotting import figure, output_notebook, show\n",
@@ -85,7 +85,7 @@
8585
"\n",
8686
"\n",
8787
" # Set up layouts and add to document\n",
88-
" inputs = widgetbox(text, offset, amplitude, phase, freq)\n",
88+
" inputs = column(text, offset, amplitude, phase, freq)\n",
8989
"\n",
9090
" doc.add_root(row(inputs, plot, width=800))\n",
9191
" doc.title = \"Sliders\""
@@ -114,7 +114,7 @@
114114
],
115115
"metadata": {
116116
"kernelspec": {
117-
"display_name": "Python 3",
117+
"display_name": "Python 3 (ipykernel)",
118118
"language": "python",
119119
"name": "python3"
120120
},
@@ -128,9 +128,9 @@
128128
"name": "python",
129129
"nbconvert_exporter": "python",
130130
"pygments_lexer": "ipython3",
131-
"version": "3.6.6"
131+
"version": "3.10.8"
132132
}
133133
},
134134
"nbformat": 4,
135-
"nbformat_minor": 2
135+
"nbformat_minor": 4
136136
}

examples/static_plot.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
],
5555
"metadata": {
5656
"kernelspec": {
57-
"display_name": "Python 3",
57+
"display_name": "Python 3 (ipykernel)",
5858
"language": "python",
5959
"name": "python3"
6060
},
@@ -68,9 +68,9 @@
6868
"name": "python",
6969
"nbconvert_exporter": "python",
7070
"pygments_lexer": "ipython3",
71-
"version": "3.6.6"
71+
"version": "3.10.8"
7272
}
7373
},
7474
"nbformat": 4,
75-
"nbformat_minor": 2
75+
"nbformat_minor": 4
7676
}

0 commit comments

Comments
 (0)