Bokeh Journal

News and updates for all things Bokeh.

Bokeh 0.12.1 Released

28 July 2016

We are pleased to announce that Bokeh Version 0.12.1 has been released!

This is a minor, incremental update that adds a few new small features and fixes several bugs. Some of the highlights include:

  • Add .patch method to ColumnDataSource for efficient partial updates.
  • Add .visible property to all glyphs for easy on/off capability.
  • Add qualitative Brewer colormaps to bokeh.palettes.
  • Add new VBar and HBar glyph types.
  • Update BokehJS to use use RBush 2.0.1 for more efficient spatial indexing.
  • Restore ResizeTool functionality for simple layouts.
  • Fix Windows support for conda build, docs build, and running unit tests.
  • Fix a bug in the HTML template for autoload_server causing incorrect layouts.
  • Fix a bug in the toolbar CSS, causing it to interfere with hit testing and selection.
  • Fix WebGL support for Safari, and WebGL bug affecting line thickness.
  • Fix intermittent issues with BokehJS loading in Jupyter notebooks.

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.

Glyph visible property

An often requested feature is a simpler way to toggle glyph visibility on and off. Thanks to Sarah Bird, this is is now possible to do by setting the .visible property of a glyph renderer to True or False. This property can be used in Bokeh Applications as well as in standalone documents that utilize CustomJS callbacks. Here is an example of the latter:

from numpy import linspace, sin, cos
from import output_file, show
from bokeh.layouts import row
from bokeh.plotting import figure
from bokeh.models import CheckboxGroup, CustomJS


x = linspace(0, 10, 100)

p = figure(plot_width=500, plot_height=300)
l0 = p.line(x, sin(x), color="firebrick", legend="line 0", line_width=4)
l1 = p.line(x, cos(x), color="navy", legend="line 1", line_width=4)
p.legend.location = "bottom_left"

checkbox = CheckboxGroup(labels=["line 0", "line 1"], active=[0, 1], width=100)
checkbox.callback = CustomJS(args=dict(l0=l0, l1=l1, checkbox=checkbox),
                             lang="coffeescript", code="""
l0.visible = 0 in;
l1.visible = 1 in;

show(row(checkbox, p))

Running the script generates the plot below. Click the checkbox to toggle the different lines on and off:

You can see an example of using this in a Bokeh application in the demo in the GitHub repository.

In a future release, this groundwork will enable toggling directly through interactive legends.

Patching for ColumnDataSource

One of the fundamental features of Bokeh Applications is that they automatically keep Python objects and JavaScript objects in sync. This makes it easy to write simple python scripts that respond to user events or interactions to update the application in the browser. But there is room for optimization in some cases. Bokeh already provides stream method for efficiently streaming new data to the end of ColumnDataSource columns. See the OHLC demo for one example of streaming.

Another place where optimization can help is when only a few individual values in a large ColumnDataSource need updating. Previously, this required re-sending the entire data set, but now there is a new patch method that can make these sorts of updates much more efficent. The patch method is called with a dictionary that specifies a list of (index, newval) tuples for any columns in the data source:

    x=[(index, newval), (index, newval), ...]
    y=[(index, newval), ...],

When used to update individual elements in columns, patch only sends the specified updated values over the network.

WebGL support for Safari

With the 0.12 release, WebGL support in Bokeh was extended to a number of new glyph types. However, WebGL support also suffered a major problem: an obscure bug prevented it from working on Safari. We were finally able to connect Almar Klein to a real Mac laptop to use for debugging, and then he squashed the bug in short order. As an example, you can see the plot below with 10,000 points panning and zooming smoothly on all platforms:

Finally, I would just like to say Thank You to all the new contributors. There was a terrific group of SciPy sprinters: Julia Signell, Sarah Heim, Tim Snyder, Steven Howell, Andrea Ernlund, and Eric Ma. And other recent contributions have come from: Nikola Hardi, John Dimattio, James Guillochon, Chris Coutinho, and Brigita Sipocz. (Apologies to anyone I have unintentionally left off.) Individual contributions such as these help move Bokeh development faster than could otherwise be possible, and are always welcome!


Bryan Van de Ven