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:
ColumnDataSourcefor efficient partial updates.
.visibleproperty to all glyphs for easy on/off capability.
ResizeToolfunctionality for simple layouts.
autoload_servercausing incorrect layouts.
This release can most easily be installed in the usual ways:
conda install bokeh if you are using Anaconda
pip install bokeh otherwise.
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
property can be used in Bokeh Applications as well as in standalone documents
CustomJS callbacks. Here is an example of the latter:
from numpy import linspace, sin, cos from bokeh.io import output_file, show from bokeh.layouts import row from bokeh.plotting import figure from bokeh.models import CheckboxGroup, CustomJS output_file("line_on_off.html") 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 checkbox.active; l1.visible = 1 in checkbox.active; """) 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 line_on_off.py demo in the GitHub repository.
In a future release, this groundwork will enable toggling directly through interactive legends.
One of the fundamental features of Bokeh Applications is that they
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
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:
source.patch(dict( 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.
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