Creating interactive web visualizations with Bokeh and HoloViews
Bokeh (http://bokeh.pydata.org/en/latest/) is a library for creating rich interactive visualizations in a browser. Plots are designed in Python, and they are rendered in the browser.
In this recipe, we will give a few short examples of interactive Bokeh figures in the Jupyter Notebook. We will also introduce HoloViews, which provides a high-level API for Bokeh and other plotting libraries.
Getting ready
Bokeh should be installed by default in Anaconda, but you can also install it manually by typing conda install bokeh
in a Terminal.
To install HoloViews, type conda install -c ioam holoviews
.
How to do it...
Let's import NumPy and Bokeh. We need to call
output_notebook()
to tell Bokeh to render plots in the Jupyter Notebook.>>> import numpy as np import pandas as pd import bokeh import bokeh.plotting as bkh bkh.output_notebook()
Let's create a scatter plot of random data:
>>> f = bkh.figure(width=600...