Bokeh 2.2
Tags: Python, Data Science, Web Development, Visualization

Bokeh 2.2 is out this week, with DataTable improvements, SVG export fixes, performance enhancements, a new DocumentReady event, and lots of other small fixes and features.

DataTables

The DataTable got a style update! The header row and overall theme have been lightened, resulting in a more modern look. #10363

New Datatable!

The DataTable also got some improved layout options. A new property was added, autosize_mode , replacing the fit_columns property. This property allows four possible approaches for determining DataTable column widths:

fit_columns : compute column widths based on the column’s cell contents, and then pad until viewport is filled.

: compute column widths based on the column’s cell contents, and then pad until viewport is filled. fit_viewport : compute the column widths, and then adjust the viewport size to match the computed sizes.

: compute the column widths, and then adjust the viewport size to match the computed sizes. force_fit : equally split the total table width across all columns.

: equally split the total table width across all columns. none : will not auto-compute widths.

DataTables also now allow row and column freezing, similar to the Excel functionality where the first row/column stays static while the rest of the table can be scrolled through. #10353

Color Mapping

This release also included the addition of the EqHistColorMapper , which uses a technique called histogram equalization to make structure visible in highly skewed distributions of data. While this technique loses information about the absolute values of data points, it can be very valuable in determining a dataset’s high-level structure. Particularly when combined with the ability to hover, you can get the best of both worlds: make out the global spatial distribution of the data, while also being able to reveal the underlying values. In the next release we will also add support for rendering a ColorBar for this color mapper to help with interpretation of the actual values.

Comparison of colormapping approaches

SVG Grid Export + Backend Redesign

A major redesign of the SVG backend was also completed with this release, fixing some layout and rendering issues:

Glpyhs being drawn slightly out of place, or not at all — axis ticks overlaying their axes, missing arrow tails, only a subset of a plot’s glyphs being rendered in the final SVG #9551

SVG export now handles NAN values correctly #10305

Removes extra whitespace in bar charts #8046

See a full list of corrected issues on the PR for this update. #10402

Currently, SVG export is available for individual plots. In the next release, an entire gridplot will be exportable as a single file with a new export_svg function.

DocumentReady

This release adds a new event type to Bokeh Server, the DocumentReady event. Previously, all components had to fully initialize before a Bokeh Server app would display. This change allows the basic page elements to be rendered quickly, so that the end user sees some visual framework, and any larger computations or data loading can be added as they complete. #10265

Performance Enhancements

Several of the features and fixes in 2.2 are direct or indirect improvements to overall performance and efficiency. Some of the notable changes are:

Remove excessive re-rendering of toolbar (also fixing a flickering effect) #10191

Speed up hovering, selection, and filtering on plots with many data points #10161 #10162 #10234

Fix over-quoting of Bokeh JSON when embedding, reducing output size #10271

Reduce memory usage by ensuring smaller types arrays are used by default for storing numerical data #10176 #10329

Fixes and Features

And finally, some tweaks and additions:

Fixed a bug where the SaveTool generated a smaller image than the plot. SaveTool now respects device pixel ratio #10249

Addressed a couple of issues with glyphs (Band, Arrow) not updating when data source updated #10216 #10217

Require authentication to open Bokeh app websocket connections. (Authentication has always been required for the initial HTTP request—this change adds an additional layer of protection.) #10316

Correct instances where typed arrays were being returned as dicts #10153

A new color palette with the colors of the Bokeh logo #10298

Bugfixes and UX improvements for Spinner widget #10367

Season of Docs

Bokeh is participating in Google’s Season of Docs, a program to foster collaboration between the open source community and technical writers. After a wonderful application phase with over 50 interested candidates, we are glad to announce that Timo Cornelius Metzger will be working with us to improve the process of creating, reading and sharing Bokeh’s documentation. Welcome, Timo!

Next Steps

If you have questions after upgrading, we encourage you to stop by the Bokeh Discourse! Friendly project maintainers and a community of Bokeh users are there to help you navigate any issues that arise.

If you are using Anaconda, Bokeh can most easily be installed by executing conda install -c bokeh bokeh . Otherwise, use pip install bokeh .

Developers interested in contributing to the library can visit Bokeh’s Slack for guidance on best practices and technical considerations.

As always, we appreciate the thoughtful feedback from users and especially the work of our contributor community that make Bokeh better!