Bokeh is a library for creating rich interactive visualizations in a browser. Plots are designed in Python, and they are entirely rendered in the browser. In this recipe, we will learn how to create and render interactive Bokeh figures in the IPython notebook.
Install Bokeh by following the instructions on the website at http://bokeh.pydata.org. In principle, you can just type pip install bokeh
in a terminal. On Windows, you can also download the binary installer from Chris Gohlke's website at http://www.lfd.uci.edu/~gohlke/pythonlibs/#bokeh.
Let's import NumPy and Bokeh. We need to call the
output_notebook()
function in order to tell Bokeh to render plots in the IPython notebook:In [1]: import numpy as np import bokeh.plotting as bkh bkh.output_notebook()
We create some random data:
In [2]: x = np.linspace(0., 1., 100) y = np.cumsum(np.random.randn(100))
Let's draw a curve:
In [3]: bkh.line(x...