bokeh.palettes#
Provide a collection of palettes for color mapping.
In the context of Bokeh, a palette is a simple plain Python list of (hex) RGB color
strings. For example the Blues8
palette which looks like
is defined as:
('#084594', '#2171b5', '#4292c6', '#6baed6', '#9ecae1', '#c6dbef', '#deebf7', '#f7fbff')
This module contains the following sets of palettes:
All ColorBrewer palettes
Categorical D3 palettes
The Matplotlib palettes Magma, Inferno, Plasma, and Viridis
A Bokeh palette comprised of the Bokeh shutter logo colors
Palettes designed for color-deficient usability
Additionally, you can also use any of the 256-color perceptually uniform Bokeh palettes from the external colorcet package, if it is installed.
Every pre-built palette is available as a module attributes, e.g.
bokeh.palettes.YlGn3
or bokeh.palettes.Viridis256
. The name of each
pre-built palette can be found in the __palettes__
module attribute.
There are also functions such as magma()
and
viridis()
that can generate lists of colors of
arbitrary size from special larger palettes.
The Brewer palettes are also collected and grouped by name in a
brewer
dictionary, e.g.: brewer['Spectral'][6]
. Similarly there are
attributes d3
, mpl
, and tol
that have dictionaries
corresponding to the those groups of palettes.
Finally, all palettes are collected in the all_palettes
palettes
module attribute, and the “small” palettes (i.e. excluding the ones with 256
colors) are collected and in a small_palettes
attribute.
Built-in Palettes#
Matplotlib Palettes#
Bokeh includes the Matplotlib palettes Magma, Inferno, Plasma, Viridis, and Cividis. This section shows the pre-defined small palettes in this group. There are also large 256-color versions of these palettes, shown below in the Large Palettes section.
Cividis |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
3 | |||||||||||
4 | |||||||||||
5 | |||||||||||
6 | |||||||||||
7 | |||||||||||
8 | |||||||||||
9 | |||||||||||
10 | |||||||||||
11 |
Inferno |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
3 | |||||||||||
4 | |||||||||||
5 | |||||||||||
6 | |||||||||||
7 | |||||||||||
8 | |||||||||||
9 | |||||||||||
10 | |||||||||||
11 |
Magma |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
3 | |||||||||||
4 | |||||||||||
5 | |||||||||||
6 | |||||||||||
7 | |||||||||||
8 | |||||||||||
9 | |||||||||||
10 | |||||||||||
11 |
Plasma |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
3 | |||||||||||
4 | |||||||||||
5 | |||||||||||
6 | |||||||||||
7 | |||||||||||
8 | |||||||||||
9 | |||||||||||
10 | |||||||||||
11 |
Viridis |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
3 | |||||||||||
4 | |||||||||||
5 | |||||||||||
6 | |||||||||||
7 | |||||||||||
8 | |||||||||||
9 | |||||||||||
10 | |||||||||||
11 |
D3 Palettes#
Bokeh includes the categorical palettes from D3, which are shown below:
Category10 |
||||||||||
---|---|---|---|---|---|---|---|---|---|---|
3 | ||||||||||
4 | ||||||||||
5 | ||||||||||
6 | ||||||||||
7 | ||||||||||
8 | ||||||||||
9 | ||||||||||
10 |
Category20 |
||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | ||||||||||||||||||||
4 | ||||||||||||||||||||
5 | ||||||||||||||||||||
6 | ||||||||||||||||||||
7 | ||||||||||||||||||||
8 | ||||||||||||||||||||
9 | ||||||||||||||||||||
10 | ||||||||||||||||||||
11 | ||||||||||||||||||||
12 | ||||||||||||||||||||
13 | ||||||||||||||||||||
14 | ||||||||||||||||||||
15 | ||||||||||||||||||||
16 | ||||||||||||||||||||
17 | ||||||||||||||||||||
18 | ||||||||||||||||||||
19 | ||||||||||||||||||||
20 |
Category20b |
||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | ||||||||||||||||||||
4 | ||||||||||||||||||||
5 | ||||||||||||||||||||
6 | ||||||||||||||||||||
7 | ||||||||||||||||||||
8 | ||||||||||||||||||||
9 | ||||||||||||||||||||
10 | ||||||||||||||||||||
11 | ||||||||||||||||||||
12 | ||||||||||||||||||||
13 | ||||||||||||||||||||
14 | ||||||||||||||||||||
15 | ||||||||||||||||||||
16 | ||||||||||||||||||||
17 | ||||||||||||||||||||
18 | ||||||||||||||||||||
19 | ||||||||||||||||||||
20 |
Category20c |
||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | ||||||||||||||||||||
4 | ||||||||||||||||||||
5 | ||||||||||||||||||||
6 | ||||||||||||||||||||
7 | ||||||||||||||||||||
8 | ||||||||||||||||||||
9 | ||||||||||||||||||||
10 | ||||||||||||||||||||
11 | ||||||||||||||||||||
12 | ||||||||||||||||||||
13 | ||||||||||||||||||||
14 | ||||||||||||||||||||
15 | ||||||||||||||||||||
16 | ||||||||||||||||||||
17 | ||||||||||||||||||||
18 | ||||||||||||||||||||
19 | ||||||||||||||||||||
20 |
Brewer Palettes#
Bokeh includes all the ColorBrewer palettes, shown below:
Accent |
||||||||
---|---|---|---|---|---|---|---|---|
3 | ||||||||
4 | ||||||||
5 | ||||||||
6 | ||||||||
7 | ||||||||
8 |
Blues |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
BrBG |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
3 | |||||||||||
4 | |||||||||||
5 | |||||||||||
6 | |||||||||||
7 | |||||||||||
8 | |||||||||||
9 | |||||||||||
10 | |||||||||||
11 |
BuGn |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
BuPu |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
Dark2 |
||||||||
---|---|---|---|---|---|---|---|---|
3 | ||||||||
4 | ||||||||
5 | ||||||||
6 | ||||||||
7 | ||||||||
8 |
GnBu |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
Greens |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
Greys |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
OrRd |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
Oranges |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
PRGn |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
3 | |||||||||||
4 | |||||||||||
5 | |||||||||||
6 | |||||||||||
7 | |||||||||||
8 | |||||||||||
9 | |||||||||||
10 | |||||||||||
11 |
Paired |
||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | ||||||||||||
4 | ||||||||||||
5 | ||||||||||||
6 | ||||||||||||
7 | ||||||||||||
8 | ||||||||||||
9 | ||||||||||||
10 | ||||||||||||
11 | ||||||||||||
12 |
Pastel1 |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
Pastel2 |
||||||||
---|---|---|---|---|---|---|---|---|
3 | ||||||||
4 | ||||||||
5 | ||||||||
6 | ||||||||
7 | ||||||||
8 |
PiYG |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
3 | |||||||||||
4 | |||||||||||
5 | |||||||||||
6 | |||||||||||
7 | |||||||||||
8 | |||||||||||
9 | |||||||||||
10 | |||||||||||
11 |
PuBu |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
PuBuGn |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
PuOr |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
3 | |||||||||||
4 | |||||||||||
5 | |||||||||||
6 | |||||||||||
7 | |||||||||||
8 | |||||||||||
9 | |||||||||||
10 | |||||||||||
11 |
PuRd |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
Purples |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
RdBu |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
3 | |||||||||||
4 | |||||||||||
5 | |||||||||||
6 | |||||||||||
7 | |||||||||||
8 | |||||||||||
9 | |||||||||||
10 | |||||||||||
11 |
RdGy |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
3 | |||||||||||
4 | |||||||||||
5 | |||||||||||
6 | |||||||||||
7 | |||||||||||
8 | |||||||||||
9 | |||||||||||
10 | |||||||||||
11 |
RdPu |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
RdYlBu |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
3 | |||||||||||
4 | |||||||||||
5 | |||||||||||
6 | |||||||||||
7 | |||||||||||
8 | |||||||||||
9 | |||||||||||
10 | |||||||||||
11 |
RdYlGn |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
3 | |||||||||||
4 | |||||||||||
5 | |||||||||||
6 | |||||||||||
7 | |||||||||||
8 | |||||||||||
9 | |||||||||||
10 | |||||||||||
11 |
Reds |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
Set1 |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
Set2 |
||||||||
---|---|---|---|---|---|---|---|---|
3 | ||||||||
4 | ||||||||
5 | ||||||||
6 | ||||||||
7 | ||||||||
8 |
Set3 |
||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | ||||||||||||
4 | ||||||||||||
5 | ||||||||||||
6 | ||||||||||||
7 | ||||||||||||
8 | ||||||||||||
9 | ||||||||||||
10 | ||||||||||||
11 | ||||||||||||
12 |
Spectral |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
3 | |||||||||||
4 | |||||||||||
5 | |||||||||||
6 | |||||||||||
7 | |||||||||||
8 | |||||||||||
9 | |||||||||||
10 | |||||||||||
11 |
YlGn |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
YlGnBu |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
YlOrBr |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
YlOrRd |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
Bokeh Palette#
Bokeh’s own palette, comprised of the shutter logo colors:
Bokeh |
||||||||
---|---|---|---|---|---|---|---|---|
3 | ||||||||
4 | ||||||||
5 | ||||||||
6 | ||||||||
7 | ||||||||
8 |
Accessible Palettes#
Bokeh includes some palettes that are useful for addressing
color deficiencies, which contains Paul Tol’s color schemes, and
Colorblind
from https://jfly.uni-koeln.de/color/#pallet.
Bright |
|||||||
---|---|---|---|---|---|---|---|
3 | |||||||
4 | |||||||
5 | |||||||
6 | |||||||
7 |
BuRd |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
HighContrast |
|||||||
---|---|---|---|---|---|---|---|
3 |
Iridescent |
|||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | |||||||||||||||||||||||
4 | |||||||||||||||||||||||
5 | |||||||||||||||||||||||
6 | |||||||||||||||||||||||
7 | |||||||||||||||||||||||
8 | |||||||||||||||||||||||
9 | |||||||||||||||||||||||
10 | |||||||||||||||||||||||
11 | |||||||||||||||||||||||
12 | |||||||||||||||||||||||
13 | |||||||||||||||||||||||
14 | |||||||||||||||||||||||
15 | |||||||||||||||||||||||
16 | |||||||||||||||||||||||
17 | |||||||||||||||||||||||
18 | |||||||||||||||||||||||
19 | |||||||||||||||||||||||
20 | |||||||||||||||||||||||
21 | |||||||||||||||||||||||
22 | |||||||||||||||||||||||
23 |
Light |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
MediumContrast |
|||||||
---|---|---|---|---|---|---|---|
3 | |||||||
4 | |||||||
5 | |||||||
6 |
Muted |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
Sunset |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
3 | |||||||||||
4 | |||||||||||
5 | |||||||||||
6 | |||||||||||
7 | |||||||||||
8 | |||||||||||
9 | |||||||||||
10 | |||||||||||
11 |
TolPRGn |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
TolRainbow |
|||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3 | |||||||||||||||||||||||
4 | |||||||||||||||||||||||
5 | |||||||||||||||||||||||
6 | |||||||||||||||||||||||
7 | |||||||||||||||||||||||
8 | |||||||||||||||||||||||
9 | |||||||||||||||||||||||
10 | |||||||||||||||||||||||
11 | |||||||||||||||||||||||
12 | |||||||||||||||||||||||
13 | |||||||||||||||||||||||
14 | |||||||||||||||||||||||
15 | |||||||||||||||||||||||
16 | |||||||||||||||||||||||
17 | |||||||||||||||||||||||
18 | |||||||||||||||||||||||
19 | |||||||||||||||||||||||
20 | |||||||||||||||||||||||
21 | |||||||||||||||||||||||
22 | |||||||||||||||||||||||
23 |
TolYlOrBr |
|||||||||
---|---|---|---|---|---|---|---|---|---|
3 | |||||||||
4 | |||||||||
5 | |||||||||
6 | |||||||||
7 | |||||||||
8 | |||||||||
9 |
Vibrant |
|||||||
---|---|---|---|---|---|---|---|
3 | |||||||
4 | |||||||
5 | |||||||
6 | |||||||
7 |
Colorblind |
||||||||
---|---|---|---|---|---|---|---|---|
3 | ||||||||
4 | ||||||||
5 | ||||||||
6 | ||||||||
7 | ||||||||
8 |
The following palettes are also introduced in Paul Tol’s color schemes
but with different usage. PaleTextBackground
should be used for the
background of black text. DarkText
is meant for text itself on a white
background. The idea is to use one dark color for support, not all combined
and not for just one word.
- PaleTextBackground:
- DarkText:
Large Palettes#
In addition to all the palettes shown above, which are available in the
small_palettes
attribute, the bokeh.palettes
module also has some
larger palettes with 256 colors. These are shown below:
- Greys256:
(brewer)
- Inferno256:
(mpl)
- Magma256:
(mpl)
- Plasma256:
(mpl)
- Viridis256:
(mpl)
- Cividis256:
(mpl)
- Turbo256:
(mpl)
Many other 256-color perceptually uniform palettes are available in the external colorcet package.
Other Attributes#
In addition to all the palettes described in the section above, there are the
following notable attributes in the bokeh.palettes
module:
- __palettes__#
An alphabetical list of the names of all individual palettes in this module.
For example, the first eight palette names are:
>>> bp.__palettes__[:8] ('Accent3', 'Accent4', 'Accent5', 'Accent6', 'Accent7', 'Accent8', 'Blues3', 'Blues4')
Note
The full list of all palettes is also available as an enumeration from
bokeh.core.enums
:- Palette = Enumeration(Accent3, Accent4, Accent5, A .... Rd5, YlOrRd6, YlOrRd7, YlOrRd8, YlOrRd9)
See all values
Enumeration(Accent3, Accent4, Accent5, Accent6, Accent7, Accent8, Blues3, Blues4, Blues5, Blues6, Blues7, Blues8, Blues9, Blues256, Bokeh3, Bokeh4, Bokeh5, Bokeh6, Bokeh7, Bokeh8, BrBG3, BrBG4, BrBG5, BrBG6, BrBG7, BrBG8, BrBG9, BrBG10, BrBG11, Bright3, Bright4, Bright5, Bright6, Bright7, BuGn3, BuGn4, BuGn5, BuGn6, BuGn7, BuGn8, BuGn9, BuPu3, BuPu4, BuPu5, BuPu6, BuPu7, BuPu8, BuPu9, BuRd3, BuRd4, BuRd5, BuRd6, BuRd7, BuRd8, BuRd9, Category10_3, Category10_4, Category10_5, Category10_6, Category10_7, Category10_8, Category10_9, Category10_10, Category20_3, Category20_4, Category20_5, Category20_6, Category20_7, Category20_8, Category20_9, Category20_10, Category20_11, Category20_12, Category20_13, Category20_14, Category20_15, Category20_16, Category20_17, Category20_18, Category20_19, Category20_20, Category20b3, Category20b4, Category20b5, Category20b6, Category20b7, Category20b8, Category20b9, Category20b10, Category20b11, Category20b12, Category20b13, Category20b14, Category20b15, Category20b16, Category20b17, Category20b18, Category20b19, Category20b20, Category20c3, Category20c4, Category20c5, Category20c6, Category20c7, Category20c8, Category20c9, Category20c10, Category20c11, Category20c12, Category20c13, Category20c14, Category20c15, Category20c16, Category20c17, Category20c18, Category20c19, Category20c20, Cividis3, Cividis4, Cividis5, Cividis6, Cividis7, Cividis8, Cividis9, Cividis10, Cividis11, Cividis256, Colorblind3, Colorblind4, Colorblind5, Colorblind6, Colorblind7, Colorblind8, Dark2_3, Dark2_4, Dark2_5, Dark2_6, Dark2_7, Dark2_8, GnBu3, GnBu4, GnBu5, GnBu6, GnBu7, GnBu8, GnBu9, Greens3, Greens4, Greens5, Greens6, Greens7, Greens8, Greens9, Greens256, Greys3, Greys4, Greys5, Greys6, Greys7, Greys8, Greys9, Greys256, HighContrast3, Inferno3, Inferno4, Inferno5, Inferno6, Inferno7, Inferno8, Inferno9, Inferno10, Inferno11, Inferno256, Iridescent3, Iridescent4, Iridescent5, Iridescent6, Iridescent7, Iridescent8, Iridescent9, Iridescent10, Iridescent11, Iridescent12, Iridescent13, Iridescent14, Iridescent15, Iridescent16, Iridescent17, Iridescent18, Iridescent19, Iridescent20, Iridescent21, Iridescent22, Iridescent23, Light3, Light4, Light5, Light6, Light7, Light8, Light9, Magma3, Magma4, Magma5, Magma6, Magma7, Magma8, Magma9, Magma10, Magma11, Magma256, MediumContrast3, MediumContrast4, MediumContrast5, MediumContrast6, Muted3, Muted4, Muted5, Muted6, Muted7, Muted8, Muted9, OrRd3, OrRd4, OrRd5, OrRd6, OrRd7, OrRd8, OrRd9, Oranges3, Oranges4, Oranges5, Oranges6, Oranges7, Oranges8, Oranges9, Oranges256, PRGn3, PRGn4, PRGn5, PRGn6, PRGn7, PRGn8, PRGn9, PRGn10, PRGn11, Paired3, Paired4, Paired5, Paired6, Paired7, Paired8, Paired9, Paired10, Paired11, Paired12, Pastel1_3, Pastel1_4, Pastel1_5, Pastel1_6, Pastel1_7, Pastel1_8, Pastel1_9, Pastel2_3, Pastel2_4, Pastel2_5, Pastel2_6, Pastel2_7, Pastel2_8, PiYG3, PiYG4, PiYG5, PiYG6, PiYG7, PiYG8, PiYG9, PiYG10, PiYG11, Plasma3, Plasma4, Plasma5, Plasma6, Plasma7, Plasma8, Plasma9, Plasma10, Plasma11, Plasma256, PuBu3, PuBu4, PuBu5, PuBu6, PuBu7, PuBu8, PuBu9, PuBuGn3, PuBuGn4, PuBuGn5, PuBuGn6, PuBuGn7, PuBuGn8, PuBuGn9, PuOr3, PuOr4, PuOr5, PuOr6, PuOr7, PuOr8, PuOr9, PuOr10, PuOr11, PuRd3, PuRd4, PuRd5, PuRd6, PuRd7, PuRd8, PuRd9, Purples3, Purples4, Purples5, Purples6, Purples7, Purples8, Purples9, Purples256, RdBu3, RdBu4, RdBu5, RdBu6, RdBu7, RdBu8, RdBu9, RdBu10, RdBu11, RdGy3, RdGy4, RdGy5, RdGy6, RdGy7, RdGy8, RdGy9, RdGy10, RdGy11, RdPu3, RdPu4, RdPu5, RdPu6, RdPu7, RdPu8, RdPu9, RdYlBu3, RdYlBu4, RdYlBu5, RdYlBu6, RdYlBu7, RdYlBu8, RdYlBu9, RdYlBu10, RdYlBu11, RdYlGn3, RdYlGn4, RdYlGn5, RdYlGn6, RdYlGn7, RdYlGn8, RdYlGn9, RdYlGn10, RdYlGn11, Reds3, Reds4, Reds5, Reds6, Reds7, Reds8, Reds9, Reds256, Set1_3, Set1_4, Set1_5, Set1_6, Set1_7, Set1_8, Set1_9, Set2_3, Set2_4, Set2_5, Set2_6, Set2_7, Set2_8, Set3_3, Set3_4, Set3_5, Set3_6, Set3_7, Set3_8, Set3_9, Set3_10, Set3_11, Set3_12, Spectral3, Spectral4, Spectral5, Spectral6, Spectral7, Spectral8, Spectral9, Spectral10, Spectral11, Sunset3, Sunset4, Sunset5, Sunset6, Sunset7, Sunset8, Sunset9, Sunset10, Sunset11, TolPRGn3, TolPRGn4, TolPRGn5, TolPRGn6, TolPRGn7, TolPRGn8, TolPRGn9, TolRainbow3, TolRainbow4, TolRainbow5, TolRainbow6, TolRainbow7, TolRainbow8, TolRainbow9, TolRainbow10, TolRainbow11, TolRainbow12, TolRainbow13, TolRainbow14, TolRainbow15, TolRainbow16, TolRainbow17, TolRainbow18, TolRainbow19, TolRainbow20, TolRainbow21, TolRainbow22, TolRainbow23, TolYlOrBr3, TolYlOrBr4, TolYlOrBr5, TolYlOrBr6, TolYlOrBr7, TolYlOrBr8, TolYlOrBr9, Turbo3, Turbo4, Turbo5, Turbo6, Turbo7, Turbo8, Turbo9, Turbo10, Turbo11, Turbo256, Vibrant3, Vibrant4, Vibrant5, Vibrant6, Vibrant7, Viridis3, Viridis4, Viridis5, Viridis6, Viridis7, Viridis8, Viridis9, Viridis10, Viridis11, Viridis256, YlGn3, YlGn4, YlGn5, YlGn6, YlGn7, YlGn8, YlGn9, YlGnBu3, YlGnBu4, YlGnBu5, YlGnBu6, YlGnBu7, YlGnBu8, YlGnBu9, YlOrBr3, YlOrBr4, YlOrBr5, YlOrBr6, YlOrBr7, YlOrBr8, YlOrBr9, YlOrRd3, YlOrRd4, YlOrRd5, YlOrRd6, YlOrRd7, YlOrRd8, YlOrRd9)
- all_palettes#
All built-in palette groups. This dictionary is indexed with a palette name to obtain a complete group of palettes, e.g.
Viridis
, and then further indexed with an integer to select a palette of a specific size from the group:>> all_palettes['Viridis'][4] ('#440154', '#30678D', '#35B778', '#FDE724')
The resulting palette looks like:
- brewer#
Palette groups included from ColorBrewer. This dictionary is indexed with a palette name to obtain a complete group of palettes, e.g.
YlGnBu
, and then further indexed with an integer to select a palette of a specific size from the group:>> brewer['YlGnBu'][4] ('#225ea8', '#41b6c4', '#a1dab4', '#ffffcc')
The resulting palette looks like:
- d3#
Categorical palette groups included from D3. This dictionary is indexed with a palette name to obtain a complete group of palettes, e.g.
Category20b
, and then further indexed with an integer to select a palette of a specific size from the group:>> d3['Category20b'][4] ('#393b79', '#5254a3', '#6b6ecf', '#9c9ede')
The resulting palette looks like:
The names of the D3 palette groups are:
Category10
,Category20
,Category20b
,Category20c
- mpl#
Palette groups included from Matplotlib. This dictionary is indexed with a palette name to obtain a complete group of palettes, e.g.
Plasma
, and then further indexed with an integer to select a palette of a specific size from the group:>> mpl['Plasma'][4] ('#440154', '#30678D', '#35B778', '#FDE724')
The resulting palette looks like:
The names of the MPL palette groups are:
Inferno
,Magma
Plasma
,Viridis
- tol#
A set of accessible palettes from Paul Tol’s color schemes. This dictionary is indexed with a palette name to obtain a complete group of palettes, e.g.
Bright
, and then further indexed with an integer to select a palette of a specific size from the group:>> tol['Bright'][4] ('#4477AA', '#EE6677', '#228833', '#CCBB44')
The resulting palette looks like:
The names of the Tol palette groups are:
Bright
,HighContrast
,Vibrant
,Muted
,MediumContrast
,Light
,Sunset
,BuRd
,TolPRGn
,TolYlOrBr
,Iridescent
,TolRainbow
- small_palettes#
All palette groups, excluding 256-length palettes. This dictionary is indexed with a palette name to obtain a complete group of palettes, e.g.
Viridis
, and then further indexed with an integer to select a palette of a specific size from the group:>> small_palettes['Viridis'][4] ('#440154', '#30678D', '#35B778', '#FDE724')
The resulting palette looks like:
Functions#
The bokeh.palettes
module also has several functions that can be used
to generate palettes of arbitrary size.
- cividis(n)[source]#
Generate a palette of colors from the Cividis palette.
The full Cividis palette that serves as input for deriving new palettes has 256 colors, and looks like:
- Parameters:
n (int) – size of the palette to generate
- Returns:
a sequence of hex RGB color strings
- Return type:
seq[str]
- Raises:
ValueError if n is greater than the base palette length of 256 –
Examples:
>>> cividis(6) ('#00204C', '#31446B', '#666870', '#958F78', '#CAB969', '#FFE945')
The resulting palette looks like:
- diverging_palette(palette1, palette2, n, midpoint)[source]#
Generate a new palette by combining exactly two input palettes.
Given an input
palette1
andpalette2
, take a combinedn
colors, and combine input palettes at the relativemidpoint
.palette1
andpalette2
are meant to be sequential palettes that proceed left to right from perceptually dark to light colors. In that case the returned palette is comprised of the input palettes connected at perceptually light ends. Palettes are combined by piecewise linear interpolation.- Parameters:
palette1 (seq[str]) – A sequence of hex RGB color strings for the first palette
palette2 (seq[str]) – A sequence of hex RGB color strings for the second palette
n (int) – The size of the output palette to generate
midpoint (float, optional) – Relative position in the returned palette where input palettes are connected (default: 0.5)
- Returns:
a sequence of hex RGB color strings
- Return type:
seq[str]
- Raises:
ValueError if n is greater than the possible combined length the input palettes –
- gray(n)[source]#
Generate a palette of colors or from the Greys palette.
The full Greys palette that serves as input for deriving new palettes has 256 colors, and looks like:
- Parameters:
n (int) – size of the palette to generate
- Returns:
a sequence of hex RGB color strings
- Return type:
seq[str]
- Raises:
ValueError if n is greater than the base palette length of 256 –
Examples:
>>> gray(6) ('#000000', '#333333', '#666666', '#999999', '#cccccc', '#ffffff')
The resulting palette looks like:
Note
This function also has the alternate spelling
grey
- grey(n)[source]#
Generate a palette of colors from the Greys palette.
The full Greys palette that serves as input for deriving new palettes has 256 colors, and looks like:
- Parameters:
n (int) – size of the palette to generate
- Returns:
a sequence of hex RGB color strings
- Return type:
seq[str]
- Raises:
ValueError if n is greater than the base palette length of 256 –
Examples:
>>> grey(6) ('#000000', '#333333', '#666666', '#999999', '#cccccc', '#ffffff')
The resulting palette looks like:
Note
This function also has the alternate spelling
gray
- inferno(n)[source]#
Generate a palette of colors from the Inferno palette.
The full Inferno palette that serves as input for deriving new palettes has 256 colors, and looks like:
- Parameters:
n (int) – size of the palette to generate
- Returns:
a sequence of hex RGB color strings
- Return type:
seq[str]
- Raises:
ValueError if n is greater than the base palette length of 256 –
Examples:
>>> inferno(6) ('#000003', '#410967', '#932567', '#DC5039', '#FBA40A', '#FCFEA4')
The resulting palette looks like:
- linear_palette(palette, n)[source]#
Generate a new palette as a subset of a given palette.
Given an input
palette
, taken
colors from it by dividing its length inton
(approximately) evenly spaced indices.
- magma(n)[source]#
Generate a palette of colors from the Magma palette.
The full Magma palette that serves as input for deriving new palettes has 256 colors, and looks like:
- Parameters:
n (int) – size of the palette to generate
- Returns:
a sequence of hex RGB color strings
- Return type:
seq[str]
- Raises:
ValueError if n is greater than the base palette length of 256 –
Examples:
>>> magma(6) ('#000003', '#3B0F6F', '#8C2980', '#DD4968', '#FD9F6C', '#FBFCBF')
The resulting palette looks like:
- varying_alpha_palette(palette, n, start_alpha, end_alpha)[source]#
Generate a palette that is a single color with linearly varying alpha.
Alpha may vary from low to high or high to low, depending on the values of
start_alpha
andend_alpha
.- Parameters:
color (str) – Named color or RGB(A) hex color string. Any alpha component is combined with the
start_alpha
toend_alpha
range by multiplying them together, so it is the maximum possible alpha that can be obtained.n (int, optional) – The size of the palette to generate. If not specified uses the maximum number of colors such that adjacent colors differ by an alpha of 1.
start_alpha (int, optional) – The alpha component of the start of the palette is this value (in the range 0 to 255) multiplied by the alpha component of the
color
argument.end_alpha (int, optional) – The alpha component of the end of the palette is this value (in the range 0 to 255) multiplied by the alpha component of the
color
argument.
- Returns:
a sequence of hex RGBA color strings
- Return type:
seq[str]
- Raises:
ValueError if color is not recognisable as a string name or hex – RGB(A) string, or if
start_alpha
orend_alpha
are outside the range 0 to 255 inclusive.
- viridis(n)[source]#
Generate a palette of colors from the Viridis palette.
The full Viridis palette that serves as input for deriving new palettes has 256 colors, and looks like:
- Parameters:
n (int) – size of the palette to generate
- Returns:
a sequence of hex RGB color strings
- Return type:
seq[str]
- Raises:
ValueError if n is greater than the base palette length of 256 –
Examples:
>>> viridis(6) ('#440154', '#404387', '#29788E', '#22A784', '#79D151', '#FDE724')
The resulting palette looks like:
Licenses#
The respective licenses for all the palettes included in Bokeh are viewable as a comment at the top of the src/bokeh/palettes.py source file.