Bokeh 0.12.2 Released

/ Luke Canavan

We’re pleased to announce the release of Bokeh 0.12.2!

This minor update adds a few “small in footprint, but big in impact” features and several bug fixes including:

  • Color mapping support for all glyphs
  • New color bar annotation (to visualize your color mapped data, obviously)
  • LaTeX!!! (via support for loading external resources in custom models)
  • Hit-testing support for MultiLine glyphs
  • Improved HoverTool default styling
  • Addition of the Brewer qualitative color palettes
  • Split of the Bokeh JS API into a stand-alone bundle
  • Some notebook and layout fixes

We’d also like to highlight a new project for creating map-based visualizations that offers Bokeh as a back-end: GeoViews. The GeoViews team has an introductory blog post that’s a worthwhile read.

Finally, we’d like to share a fun Bokeh visualization from Megan Bedell, an astronomy doctoral student at University of Chicago. On her academic page, she has plot of exoplanet compositions and masses versus radii with elements that link to the planetary system’s page at Open Expoplanet Catalogue when clicked. So cool!

For full details, see the CHANGELOG and Release Notes.

This release can most easily be installed in the usual ways: conda install bokeh if you are using Anaconda or pip install bokeh otherwise.

LaTeX!!! (via support for loading external resources in custom models)

One exciting aspect of Bokeh is the ability to create custom extensions. Bokeh v0.12.2 has added support for including third-party JavaScript libraries or CSS resources through the Python class attributes __javascript__ and __css__ of custom models. This new functionality allows users to include the necessary JS and CSS files in order to use the wonderful KaTeX library in the creation of a LaTeXLabel custom model.

class LaTeXLabel(Label):
    """A subclass of the Bokeh built-in `Label` that supports rendering
    LaTeX using the KaTeX typesetting library.
    __javascript__ = ""
    __css__ = ""
    __implementation__ = "..."

See the LaTex example in the extensions gallery to see the full implementation. The output is below:

Apart from rendering LaTeX, support for third-party resources allows users to utilize any JavaScript library. Developing custom map visualizations using Mapbox.js or custom plugins from IonDen is now possible.

New color mapping capability and color bar annotation

Support for “computed transforms” was added in the 0.12.0 release, in order to do things like add a jitter to a data column. Thanks to Sarah Bird, color mapping is now a supported computed transform, making it possible to use a ColorMapper object to map a data column to a color palette.

Bokeh has also added a new ColorBar annotation, which accepts the same ColorMapper as an argument. Here is an example of both:

from bokeh.models import HoverTool, ColorBar, LinearColorMapper, FixedTicker
from bokeh.plotting import figure, show, output_file, ColumnDataSource
from bokeh.sampledata.us_counties import data as counties
from bokeh.sampledata.unemployment import data as unemployment

output_file("texas.html", title=" example")

counties = {
    code: county for code, county in counties.items() if county["state"] == "tx"

county_xs = [county["lons"] for county in counties.values()]
county_ys = [county["lats"] for county in counties.values()]
county_names = [county['name'] for county in counties.values()]
county_rates = [unemployment[county_id] for county_id in counties]

source = ColumnDataSource(data=dict(

color_mapper = LinearColorMapper(palette="Viridis8", low=2, high=18)


p = figure(title="Texas Unemployment 2009", tools=TOOLS,
           x_axis_location=None, y_axis_location=None)
p.grid.grid_line_color = None

# Here we're applying the color_mapper instance as the transform to the
# `rate` data field in order to set the Patch `fill_color`
p.patches('x', 'y', source=source,
          fill_color={'field': 'rate', 'transform': color_mapper},
          fill_alpha=0.7, line_color="white", line_width=0.5)

hover = p.select_one(HoverTool)
hover.point_policy = "follow_mouse"
hover.tooltips = [
    ("Name", "@name"),
    ("Unemployment rate)", "@rate%"),
    ("(Long, Lat)", "($x, $y)"),

color_bar = ColorBar(color_mapper=color_mapper, orientation='horizontal',
                     location='bottom_left', scale_alpha=0.7,


Running the script generates the plot below. Additionally, if you hover over the Texas counties you’ll notice the new default HoverTool styling.

There are nearly 200 total contributors to Bokeh and their time and effort are what make Bokeh such an amazing project and community. Thank you again for your contributions.

Finally (as always), for questions, technical assistance or if you’re interested in contributing, please ask the Bokeh mailing list or join the chat on Gitter.


Luke Canava