|
597 | 597 | "your data. This includes palettes from\n",
|
598 | 598 | "[ColorBrewer](http://colorbrewer2.org/#type=sequential&scheme=BuGn&n=3),\n",
|
599 | 599 | "[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", |
601 | 603 | "\n",
|
602 | 604 | "These palettes are available in the ``bokeh.palettes`` module. Palettes are dictionaries\n",
|
603 | 605 | "with different pre-defined ranges of colors. In many cases, you can access a list\n",
|
|
668 | 670 | "To provide information about what color maps to which numerical value, you can add a\n",
|
669 | 671 | "color bar to your plot.\n",
|
670 | 672 | "\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", |
673 | 676 | "\n",
|
674 | 677 | "1. Defining the color bar as a ``ColorBar`` object. Use the `color_mapper`\n",
|
675 | 678 | " parameter to define the color mapper to use. In this case, you use the\n",
|
|
686 | 689 | "source": [
|
687 | 690 | "from bokeh.models import ColorBar\n",
|
688 | 691 | "\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", |
690 | 693 | "mapper_plot.add_layout(obj=color_bar, place=\"right\") # add the color bar to the plot you created above\n",
|
691 | 694 | "\n",
|
692 | 695 | "show(mapper_plot)"
|
|
697 | 700 | "cell_type": "markdown",
|
698 | 701 | "metadata": {},
|
699 | 702 | "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." |
702 | 705 | ]
|
703 | 706 | },
|
704 | 707 | {
|
|
0 commit comments