Skip to content

Commit 42c5667

Browse files
authored
fix color_bar explanation in chapter 05 (#13)
1 parent c016465 commit 42c5667

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

notebooks/05_styling.ipynb

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"cells": [
33
{
4+
"attachments": {},
45
"cell_type": "markdown",
56
"metadata": {},
67
"source": [
@@ -46,6 +47,7 @@
4647
]
4748
},
4849
{
50+
"attachments": {},
4951
"cell_type": "markdown",
5052
"metadata": {},
5153
"source": [
@@ -59,6 +61,7 @@
5961
]
6062
},
6163
{
64+
"attachments": {},
6265
"cell_type": "markdown",
6366
"metadata": {},
6467
"source": [
@@ -99,6 +102,7 @@
99102
]
100103
},
101104
{
105+
"attachments": {},
102106
"cell_type": "markdown",
103107
"metadata": {},
104108
"source": [
@@ -107,6 +111,7 @@
107111
]
108112
},
109113
{
114+
"attachments": {},
110115
"cell_type": "markdown",
111116
"metadata": {},
112117
"source": [
@@ -154,6 +159,7 @@
154159
]
155160
},
156161
{
162+
"attachments": {},
157163
"cell_type": "markdown",
158164
"metadata": {},
159165
"source": [
@@ -225,6 +231,7 @@
225231
]
226232
},
227233
{
234+
"attachments": {},
228235
"cell_type": "markdown",
229236
"metadata": {},
230237
"source": [
@@ -260,13 +267,15 @@
260267
]
261268
},
262269
{
270+
"attachments": {},
263271
"cell_type": "markdown",
264272
"metadata": {},
265273
"source": [
266274
"See the [Styling plot elements](https://docs.bokeh.org/en/latest/docs/user_guide/styling/plots.html#ug-styling-plots) section of the user guide for more details."
267275
]
268276
},
269277
{
278+
"attachments": {},
270279
"cell_type": "markdown",
271280
"metadata": {},
272281
"source": [
@@ -315,6 +324,7 @@
315324
]
316325
},
317326
{
327+
"attachments": {},
318328
"cell_type": "markdown",
319329
"metadata": {},
320330
"source": [
@@ -323,6 +333,7 @@
323333
]
324334
},
325335
{
336+
"attachments": {},
326337
"cell_type": "markdown",
327338
"metadata": {},
328339
"source": [
@@ -356,6 +367,7 @@
356367
]
357368
},
358369
{
370+
"attachments": {},
359371
"cell_type": "markdown",
360372
"metadata": {},
361373
"source": [
@@ -411,6 +423,7 @@
411423
]
412424
},
413425
{
426+
"attachments": {},
414427
"cell_type": "markdown",
415428
"metadata": {},
416429
"source": [
@@ -419,6 +432,7 @@
419432
]
420433
},
421434
{
435+
"attachments": {},
422436
"cell_type": "markdown",
423437
"metadata": {},
424438
"source": [
@@ -468,6 +482,7 @@
468482
]
469483
},
470484
{
485+
"attachments": {},
471486
"cell_type": "markdown",
472487
"metadata": {},
473488
"source": [
@@ -477,6 +492,7 @@
477492
]
478493
},
479494
{
495+
"attachments": {},
480496
"cell_type": "markdown",
481497
"metadata": {},
482498
"source": [
@@ -561,6 +577,7 @@
561577
]
562578
},
563579
{
580+
"attachments": {},
564581
"cell_type": "markdown",
565582
"metadata": {},
566583
"source": [
@@ -570,6 +587,7 @@
570587
]
571588
},
572589
{
590+
"attachments": {},
573591
"cell_type": "markdown",
574592
"metadata": {},
575593
"source": [
@@ -600,6 +618,7 @@
600618
]
601619
},
602620
{
621+
"attachments": {},
603622
"cell_type": "markdown",
604623
"metadata": {},
605624
"source": [
@@ -644,20 +663,17 @@
644663
]
645664
},
646665
{
666+
"attachments": {},
647667
"cell_type": "markdown",
648668
"metadata": {},
649669
"source": [
650670
"To provide information about what color maps to which numerical value, you can add a\n",
651671
"color bar to your plot.\n",
652672
"\n",
653-
"To add a color bar, use the ``construct_color_bar()`` method of your glyph. \n",
654-
"\n",
655673
"Adding a color bar is a two-step process:\n",
656674
"\n",
657-
"1. Defining the color bar as a ``ColorBar`` object. Use the `color_mapper`\n",
658-
" parameter to define the color mapper to use. In this case, you use the\n",
659-
" color mapper transform associated with the glyph.\n",
660-
"2. Adding the `ColorBar` object to the figure. Use the `add_layout` method to\n",
675+
"1. Defining the color bar with the ``construct_color_bar()`` method\n",
676+
"2. Adding the color bar to the figure. Use the `add_layout` method to\n",
661677
" add the object and define its position."
662678
]
663679
},
@@ -667,15 +683,14 @@
667683
"metadata": {},
668684
"outputs": [],
669685
"source": [
670-
"from bokeh.models import ColorBar # only needed to create a ColorBar directly rather than using construct_color_bar\n",
671-
"\n",
672686
"color_bar = circle_scatter.construct_color_bar() # create a color bar based on the glyph's color mapper\n",
673687
"mapper_plot.add_layout(obj=color_bar, place=\"right\") # add the color bar to the plot you created above\n",
674688
"\n",
675689
"show(mapper_plot)"
676690
]
677691
},
678692
{
693+
"attachments": {},
679694
"cell_type": "markdown",
680695
"metadata": {},
681696
"source": [
@@ -684,6 +699,7 @@
684699
]
685700
},
686701
{
702+
"attachments": {},
687703
"cell_type": "markdown",
688704
"metadata": {},
689705
"source": [
@@ -737,6 +753,7 @@
737753
]
738754
},
739755
{
756+
"attachments": {},
740757
"cell_type": "markdown",
741758
"metadata": {},
742759
"source": [
@@ -746,6 +763,7 @@
746763
]
747764
},
748765
{
766+
"attachments": {},
749767
"cell_type": "markdown",
750768
"metadata": {},
751769
"source": [

0 commit comments

Comments
 (0)