Skip to content

Commit 03d985f

Browse files
authored
Notebook review (#23)
* initial commit * uninstalled pre-commit * modified up to chapter 9 * finished all notebooks
1 parent 36dbfe9 commit 03d985f

16 files changed

+95
-109
lines changed

.github/workflows/pre-commit.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

notebooks/01_introduction.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@
183183
"# 🔁 Modify the string for title below to change the title of the plot\n",
184184
"plot = figure(title=\"Please change this title\")\n",
185185
"\n",
186-
"plot.circle([1, 2, 3], [6, 7, 4], size=10)\n",
186+
"plot.scatter([1, 2, 3], [6, 7, 4], size=10, marker=\"circle\")\n",
187187
"show(plot)"
188188
]
189189
},
@@ -287,9 +287,9 @@
287287
],
288288
"metadata": {
289289
"kernelspec": {
290-
"display_name": "global-global-interactive-dataviz-bokeh",
290+
"display_name": "Python 3 (ipykernel)",
291291
"language": "python",
292-
"name": "conda-env-global-global-interactive-dataviz-bokeh-py"
292+
"name": "python3"
293293
},
294294
"language_info": {
295295
"codemirror_mode": {
@@ -301,7 +301,7 @@
301301
"name": "python",
302302
"nbconvert_exporter": "python",
303303
"pygments_lexer": "ipython3",
304-
"version": "3.11.4"
304+
"version": "3.12.0"
305305
},
306306
"vscode": {
307307
"interpreter": {

notebooks/03_basic_concepts.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
"\n",
158158
"A glyph is a visual representation of data. In the example above, the line representing\n",
159159
"the x and y data is a line glyph. Bokeh supports many different kinds of glyphs to use\n",
160-
"inside of plots. Examples of glyphs include circles, wedges, bars, or tiles.\n",
160+
"inside of plots. Examples of glyphs include scatters, wedges, bars, or tiles.\n",
161161
"\n",
162162
"You will use some of the most common glyphs throughout this tutorial."
163163
]
@@ -231,13 +231,13 @@
231231
"\n",
232232
"# create three plots with one renderer each\n",
233233
"s1 = figure(width=250, height=250, background_fill_color=\"#fafafa\")\n",
234-
"s1.circle(x, y0, size=12, color=\"#53777a\", alpha=0.8)\n",
234+
"s1.scatter(x, y0, size=12, color=\"#53777a\", alpha=0.8, marker=\"circle\")\n",
235235
"\n",
236236
"s2 = figure(width=250, height=250, background_fill_color=\"#fafafa\")\n",
237-
"s2.triangle(x, y1, size=12, color=\"#c02942\", alpha=0.8)\n",
237+
"s2.scatter(x, y1, size=12, color=\"#c02942\", alpha=0.8, marker=\"triangle\")\n",
238238
"\n",
239239
"s3 = figure(width=250, height=250, background_fill_color=\"#fafafa\")\n",
240-
"s3.square(x, y2, size=12, color=\"#d95b43\", alpha=0.8)\n",
240+
"s3.scatter(x, y2, size=12, color=\"#d95b43\", alpha=0.8, marker=\"square\")\n",
241241
"\n",
242242
"# put the results in a row and show\n",
243243
"show(row(s1, s2, s3))"
@@ -270,9 +270,9 @@
270270
],
271271
"metadata": {
272272
"kernelspec": {
273-
"display_name": "global-global-interactive-dataviz-bokeh",
273+
"display_name": "Python 3 (ipykernel)",
274274
"language": "python",
275-
"name": "conda-env-global-global-interactive-dataviz-bokeh-py"
275+
"name": "python3"
276276
},
277277
"language_info": {
278278
"codemirror_mode": {
@@ -284,7 +284,7 @@
284284
"name": "python",
285285
"nbconvert_exporter": "python",
286286
"pygments_lexer": "ipython3",
287-
"version": "3.11.4"
287+
"version": "3.12.0"
288288
},
289289
"vscode": {
290290
"interpreter": {

notebooks/04_basic_plots.ipynb

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,7 @@
294294
"Creating a scatter plot follows a similar pattern as creating a line chart:\n",
295295
"\n",
296296
"1. Create a new figure using the `figure()` function.\n",
297-
"2. Add the scatter plot points to the figure using a glyph function\n",
298-
"(such as `circle()` or `square()`).\n",
297+
"2. Add the scatter plot points to the figure using the scatter glyph function.\n",
299298
"3. Display the plot using the `show()` function.\n",
300299
"\n",
301300
"For example:"
@@ -311,7 +310,7 @@
311310
"p = figure(width=400, height=200)\n",
312311
"\n",
313312
"# add a circle renderer with x and y coordinates and size\n",
314-
"p.circle([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], size=15)\n",
313+
"p.scatter([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], size=15)\n",
315314
"\n",
316315
"show(p) # show the results"
317316
]
@@ -321,7 +320,7 @@
321320
"metadata": {},
322321
"source": [
323322
"Changing the shapes representing the points in your scatter plot is easy.\n",
324-
"Just swap out the `circle()` function for a different glyph function.\n",
323+
"Just specify the `marker` type for a different scatter glyph shape. The default is `circle`\n",
325324
"\n",
326325
"The cell below contains a scatter plot with different scatter markers that you\n",
327326
"can try. This example also uses additional arguments to change the color\n",
@@ -341,14 +340,14 @@
341340
"x = [1, 2, 3, 4, 5]\n",
342341
"y = [6, 7, 2, 4, 5]\n",
343342
"\n",
344-
"# 🔁 use one of the different glyph functions to see what they do\n",
345-
"p.triangle(x, y, size=15, color=\"red\", alpha=0.5)\n",
346-
"# p.triangle_dot(x, y, size=15, color=\"yellow\", alpha=0.5)\n",
347-
"# p.square(x, y, size=15, color=\"pink\", alpha=0.5)\n",
348-
"# p.square_dot(x, y, size=15, color=\"blue\", alpha=0.5)\n",
349-
"# p.square_cross(x, y, size=15, color=\"green\", alpha=0.5)\n",
350-
"# p.square_pin(x, y, size=15, color=\"maroon\", alpha=0.5)\n",
351-
"# p.asterisk(x, y, size=15, color=\"orange\", alpha=0.5)\n",
343+
"# 🔁 use one of the different marker types to see what they do\n",
344+
"# p.scatter(x, y, size=15, color=\"red\", alpha=0.5, marker=\"triangle\")\n",
345+
"# p.scatter(x, y, size=15, color=\"yellow\", alpha=0.5, marker=\"triangle_dot\")\n",
346+
"# p.scatter(x, y, size=15, color=\"pink\", alpha=0.5, marker=\"square\")\n",
347+
"# p.scatter(x, y, size=15, color=\"blue\", alpha=0.5, marker=\"square_dot\")\n",
348+
"# p.scatter(x, y, size=15, color=\"green\", alpha=0.5, marker=\"square_cross\")\n",
349+
"# p.scatter(x, y, size=15, color=\"maroon\", alpha=0.5, marker=\"square_pin\")\n",
350+
"# p.scatter(x, y, size=15, color=\"orange\", alpha=0.5, marker=\"asterisk\")\n",
352351
"\n",
353352
"show(p) # show the results"
354353
]
@@ -387,7 +386,7 @@
387386
"plot.line(x, y)\n",
388387
"\n",
389388
"# add scatter markers to the plot\n",
390-
"plot.circle_dot(x, y, size=15, color=\"red\", alpha=0.5)\n",
389+
"plot.scatter(x, y, size=15, color=\"red\", alpha=0.5, marker=\"circle_dot\")\n",
391390
"\n",
392391
"show(plot)"
393392
]
@@ -525,13 +524,20 @@
525524
"Customizing the appearance of your plot is what you'll learn about in the\n",
526525
"[next chapter](05_styling.ipynb) of this tutorial!"
527526
]
527+
},
528+
{
529+
"cell_type": "code",
530+
"execution_count": null,
531+
"metadata": {},
532+
"outputs": [],
533+
"source": []
528534
}
529535
],
530536
"metadata": {
531537
"kernelspec": {
532-
"display_name": "global-global-interactive-dataviz-bokeh",
538+
"display_name": "Python 3 (ipykernel)",
533539
"language": "python",
534-
"name": "conda-env-global-global-interactive-dataviz-bokeh-py"
540+
"name": "python3"
535541
},
536542
"language_info": {
537543
"codemirror_mode": {
@@ -543,7 +549,7 @@
543549
"name": "python",
544550
"nbconvert_exporter": "python",
545551
"pygments_lexer": "ipython3",
546-
"version": "3.11.4"
552+
"version": "3.12.0"
547553
},
548554
"vscode": {
549555
"interpreter": {

notebooks/05_styling.ipynb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
"### Visual properties\n",
114114
"\n",
115115
"All the elements of a Bokeh visualization are Python objects. You can customize their\n",
116-
"appearance by setting these objects' properties.s\n",
116+
"appearance by setting these objects' properties.\n",
117117
"\n",
118118
"Bokeh's visual properties work similarly across different kinds of objects.\n",
119119
"They are organized into four groups:\n",
@@ -254,7 +254,7 @@
254254
"plot.background_fill_color = \"lightblue\" # set a background color\n",
255255
"plot.xgrid.grid_line_color = None # make the x-axis grid lines invisible\n",
256256
"\n",
257-
"plot.circle([1, 2, 3, 4, 5], [2, 5, 8, 2, 7], size=10)\n",
257+
"plot.scatter([1, 2, 3, 4, 5], [2, 5, 8, 2, 7], size=10)\n",
258258
"\n",
259259
"show(plot)"
260260
]
@@ -279,15 +279,15 @@
279279
"For example:\n",
280280
"\n",
281281
"```python\n",
282-
"plot.circle(x, y, fill_color='yellow', line_color='red')\n",
282+
"plot.scatter(x, y, fill_color='yellow', line_color='red')\n",
283283
"```\n",
284284
"\n",
285285
"Or you can set the properties of the glyph after you have defined it. To access the\n",
286286
"visual properties of a glyph after defining it for the first time, use the ``.glyph``\n",
287287
"attribute. For example:\n",
288288
"\n",
289289
"```python\n",
290-
"circle = plot.circle(x, y)\n",
290+
"circle = plot.scatter(x, y)\n",
291291
"circle.glyph.fill_color = 'green'\n",
292292
"circle.glyph.line_color = 'blue'\n",
293293
"```\n",
@@ -307,7 +307,7 @@
307307
"plot = figure(height=300)\n",
308308
"\n",
309309
"# add a circle glyph and define its colors to be \"yellow\" and \"red\"\n",
310-
"circle = plot.circle([1, 2, 3], [2, 5, 8], size=15, fill_color=\"yellow\", line_color=\"red\")\n",
310+
"circle = plot.scatter([1, 2, 3], [2, 5, 8], size=15, fill_color=\"yellow\", line_color=\"red\")\n",
311311
"circle.glyph.fill_color = \"green\" # use the .glyph attribute to access the visual properties of the glyph\n",
312312
"circle.glyph.line_color = \"blue\"\n",
313313
"\n",
@@ -486,7 +486,7 @@
486486
"attribute when calling the renderer function. For example:\n",
487487
"\n",
488488
"```python\n",
489-
"p.circle(x, y3, legend_label=\"Temperature\")\n",
489+
"p.scatter(x, y3, legend_label=\"Temperature\")\n",
490490
"```\n",
491491
"\n",
492492
"This adds a legend with the entry \"Temperature\" to your plot.\n",
@@ -527,7 +527,7 @@
527527
" line_color=\"blue\",\n",
528528
" line_width=2,\n",
529529
")\n",
530-
"circle = legends_plot.circle(\n",
530+
"circle = legends_plot.scatter(\n",
531531
" x,\n",
532532
" y2,\n",
533533
" legend_label=\"Objects\",\n",
@@ -633,7 +633,7 @@
633633
"mapper_plot = figure(width=500, height=250)\n",
634634
"\n",
635635
"# create circle renderer with color mapper\n",
636-
"circle_scatter = mapper_plot.circle(\n",
636+
"circle_scatter = mapper_plot.scatter(\n",
637637
" x,\n",
638638
" y,\n",
639639
" color=linear_cmap(\"y\", \"Turbo256\", min(y), max(y)),\n",
@@ -760,9 +760,9 @@
760760
],
761761
"metadata": {
762762
"kernelspec": {
763-
"display_name": "global-global-interactive-dataviz-bokeh",
763+
"display_name": "Python 3 (ipykernel)",
764764
"language": "python",
765-
"name": "conda-env-global-global-interactive-dataviz-bokeh-py"
765+
"name": "python3"
766766
},
767767
"language_info": {
768768
"codemirror_mode": {
@@ -774,7 +774,7 @@
774774
"name": "python",
775775
"nbconvert_exporter": "python",
776776
"pygments_lexer": "ipython3",
777-
"version": "3.11.4"
777+
"version": "3.12.0"
778778
},
779779
"vscode": {
780780
"interpreter": {

notebooks/06_data_sources.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
"column names to sequences of values.\n",
9393
"\n",
9494
"You can create a ColumnDataSource from Python dictionaries. The keys of the dictionary\n",
95-
"are the column names, and the values are the sequences of values:"
95+
"are the column names, and the values of the dictionary are the sequences of values:"
9696
]
9797
},
9898
{
@@ -191,7 +191,7 @@
191191
"metadata": {},
192192
"source": [
193193
"In the examples so far, you have used a Python list or pandas series for the `x` and `y`\n",
194-
"values of functions like `p.circle`. This means that Bokeh has created the\n",
194+
"values of functions like `p.scatter`. This means that Bokeh has created the\n",
195195
"ColumnDataSource for you automatically.\n",
196196
"\n",
197197
"However, instead of passing individual sequences of values to a renderer, you can also\n",
@@ -225,7 +225,7 @@
225225
"\n",
226226
"# create a plot and renderer with ColumnDataSource data\n",
227227
"p = figure(height=300)\n",
228-
"p.circle(\n",
228+
"p.scatter(\n",
229229
" x=\"x_values\", # use the sequence in the \"x_values\" column\n",
230230
" y=\"y_values\", # use the sequence in the \"y_values\" column\n",
231231
" source=source, # use the ColumnDataSource as the data source\n",
@@ -423,7 +423,7 @@
423423
"\n",
424424
"p = figure(height=300)\n",
425425
"\n",
426-
"p.circle(\n",
426+
"p.scatter(\n",
427427
" x=\"x\",\n",
428428
" y=\"y\",\n",
429429
" radius=\"r\",\n",
@@ -467,9 +467,9 @@
467467
],
468468
"metadata": {
469469
"kernelspec": {
470-
"display_name": "global-global-interactive-dataviz-bokeh",
470+
"display_name": "Python 3 (ipykernel)",
471471
"language": "python",
472-
"name": "conda-env-global-global-interactive-dataviz-bokeh-py"
472+
"name": "python3"
473473
},
474474
"language_info": {
475475
"codemirror_mode": {
@@ -481,7 +481,7 @@
481481
"name": "python",
482482
"nbconvert_exporter": "python",
483483
"pygments_lexer": "ipython3",
484-
"version": "3.10.12"
484+
"version": "3.12.0"
485485
},
486486
"vscode": {
487487
"interpreter": {

notebooks/07_annotations.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@
233233
"from bokeh.plotting import figure\n",
234234
"\n",
235235
"p = figure(x_range=(0, 10), y_range=(0, 10), height=300)\n",
236-
"p.circle([2, 5, 8], [4, 7, 6], color=\"olive\", size=10)\n",
236+
"p.scatter([2, 5, 8], [4, 7, 6], color=\"olive\", size=10)\n",
237237
"\n",
238238
"# 🔁 adjust some of the properties of this label\n",
239239
"# first label, using the same coordinates as the circle (5 on the x-axis and 7 on the y-axis)\n",
@@ -414,9 +414,9 @@
414414
],
415415
"metadata": {
416416
"kernelspec": {
417-
"display_name": "global-global-interactive-dataviz-bokeh",
417+
"display_name": "Python 3 (ipykernel)",
418418
"language": "python",
419-
"name": "conda-env-global-global-interactive-dataviz-bokeh-py"
419+
"name": "python3"
420420
},
421421
"language_info": {
422422
"codemirror_mode": {
@@ -428,7 +428,7 @@
428428
"name": "python",
429429
"nbconvert_exporter": "python",
430430
"pygments_lexer": "ipython3",
431-
"version": "3.11.4"
431+
"version": "3.12.0"
432432
},
433433
"vscode": {
434434
"interpreter": {

0 commit comments

Comments
 (0)