I\'m writing a report whose plots are all rendered with Matplotlib
. I\'ve adjusted Matplotlib
\'s default to ensure that all plots have the same sty
As of Bokeh 0.12.4
there are still open issues (features to develop as well as a few bugs, and more documentation support) around theming in Bokeh. What is currently supported is type-based theming using a Theme
object that can be set on the current document.
The Theme
object takes a JSON block, of the general form:
{
'attrs: {
'SomeTypeName': { 'foo_property': default_foo },
'OtherTypeName': { 'bar_property': default_bar }
}
}
Or for a concrete example:
from bokeh.io import curdoc
from bokeh.themes import Theme
curdoc().theme = Theme(json={'attrs': {
# apply defaults to Figure properties
'Figure': {
'toolbar_location': None,
'outline_line_color': None,
'min_border_right': 10,
},
# apply defaults to Axis properties
'Axis': {
'major_tick_in': None,
'minor_tick_out': None,
'minor_tick_in': None,
'axis_line_color': '#CAC6B6',
'major_tick_line_color': '#CAC6B6',
},
# apply defaults to Legend properties
'Legend': {
'background_fill_alpha': 0.8,
}
}})
This JSON could also be read from a file using standard Python JSON tools.
If this also happens to be in the context of a (directory style) Bokeh server application, you can also provide the theme as a theme.yaml
file in the same directory as your main.py
. See, e.g., the Gapminder example.