Bokeh Tutorial

00. Introduction and Setup

What is Bokeh

Bokeh is a Data Visualization library for

  • interactive visualization in modern browsers
  • standalone HTML documents, or server-backed apps
  • capable of expressive and verstatile graphics
  • can handle large, dynamic or streaming data
  • available from python (or Scala, or R, or Julia, or...)

And most importantly:


What can you do with Bokeh

In [1]:
# Standard imports 

from import output_notebook, show
Loading BokehJS ...
In [2]:
# Plot a complex chart in a single line

from bokeh.charts import Histogram
from bokeh.sampledata.iris import flowers as data

hist = Histogram(data, values="petal_length", color="species", legend="top_right", bins=12)

In [3]:
# Build and serve beautiful web-ready interactive visualizations

import utils
p = utils.get_gapminder_plot()
In [4]:
# Create and deploy interactive data applications

from IPython.display import IFrame
IFrame('', width=900, height=500)

How does it work

Getting set up

In [5]:
from IPython.core.display import Markdown

Bokeh Tutorial


Clone or download the repo

First get local copies of the tutorial notebooks:

$ git clone

Or download from:

Install the dependencies

This tutorial has been tested on:

  • bokeh=0.12.0
  • pandas=0.18
  • ipython-notebook=4.0.4
  • ipywidgets=4.1.1

Other combinations may work also. Packages are available via PyPI and

Installing with anaconda

Install anaconda

Anaconda should come with all the dependencies included, but you may need to update your versions.

Install with miniconda

Install miniconda.

Use the command line to create an environment and install the packages:

$ conda env create
$ source activate bokeh-notebooks

Run this from the tutorial directory where environment.yml lives.

Get the sample data

Bokeh has a sample data download that gives us some data to build demo visualizations. To get it run:

$ bokeh sampledata

Install datashader and holoviews (optional)

Optional tutorials 11 and 12 require the datashader and holoviews packages, respectively, which can be installed with:

$ conda install -c bokeh datashader
$ conda install -c holoviews/label/dev holoviews

Run Jupyter/IPython notebook

From this folder run jupyter notebook, and open the 00-intro.ipynb notebook.

$ jupyter notebook

Setup-test, run the next cell. Hopefully you should see output that looks something like this:

IPython - 5.1.0
Pandas - 0.18.1
Bokeh - 0.12.2

If this isn't working for you, see the in this directory.

In [6]:
from IPython import __version__ as ipython_version
from pandas import __version__ as pandas_version
from bokeh import __version__ as bokeh_version
print("IPython - %s" % ipython_version)
print("Pandas - %s" % pandas_version)
print("Bokeh - %s" % bokeh_version)
IPython - 5.1.0
Pandas - 0.18.1
Bokeh - 0.12.2rc3
In [ ]: