Skip to content

Commit c44a60c

Browse files
authored
Use construct_color_bar method (#8)
1 parent 01b37f2 commit c44a60c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

notebooks/05_styling.ipynb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,9 @@
597597
"your data. This includes palettes from\n",
598598
"[ColorBrewer](http://colorbrewer2.org/#type=sequential&scheme=BuGn&n=3),\n",
599599
"[D3](https://github.com/d3/d3-3.x-api-reference/blob/master/Ordinal-Scales.md#categorical-colors),\n",
600-
"or [Matplotlib](https://matplotlib.org/examples/color/colormaps_reference.html).\n",
600+
"or [Matplotlib](https://matplotlib.org/examples/color/colormaps_reference.html)\n",
601+
"(see [palettes](https://docs.bokeh.org/en/latest/docs/reference/palettes.html#module-bokeh.palettes)\n",
602+
"in the reference guide for a full list).\n",
601603
"\n",
602604
"These palettes are available in the ``bokeh.palettes`` module. Palettes are dictionaries\n",
603605
"with different pre-defined ranges of colors. In many cases, you can access a list\n",
@@ -668,8 +670,9 @@
668670
"To provide information about what color maps to which numerical value, you can add a\n",
669671
"color bar to your plot.\n",
670672
"\n",
671-
"To add a color bar, use Bokeh's `ColorBar` object. Adding a color bar is a two-step\n",
672-
"process:\n",
673+
"To add a color bar, use the ``construct_color_bar()`` method of your glyph. \n",
674+
"\n",
675+
"Adding a color bar is a two-step process:\n",
673676
"\n",
674677
"1. Defining the color bar as a ``ColorBar`` object. Use the `color_mapper`\n",
675678
" parameter to define the color mapper to use. In this case, you use the\n",
@@ -686,7 +689,7 @@
686689
"source": [
687690
"from bokeh.models import ColorBar\n",
688691
"\n",
689-
"color_bar = ColorBar(color_mapper=circle_scatter.glyph.fill_color.transform) # create a ColorBar based on the glyph's color mapper\n",
692+
"color_bar = circle_scatter.construct_color_bar() # create a color bar based on the glyph's color mapper\n",
690693
"mapper_plot.add_layout(obj=color_bar, place=\"right\") # add the color bar to the plot you created above\n",
691694
"\n",
692695
"show(mapper_plot)"
@@ -697,8 +700,8 @@
697700
"cell_type": "markdown",
698701
"metadata": {},
699702
"source": [
700-
"See [palettes](https://docs.bokeh.org/en/latest/docs/reference/palettes.html#module-bokeh.palettes)\n",
701-
"in the reference guide for a list of all available palettes."
703+
"See [Color bars](https://docs.bokeh.org/en/latest/docs/user_guide/basic/annotations.html#color-bars)\n",
704+
"in the user guide for more information."
702705
]
703706
},
704707
{

0 commit comments

Comments
 (0)