00. Introduction and Setup

Welcome to the HoloViews+Bokeh SciPy 2017 tutorial!

This notebook serves as the homepage of the tutorial, including a general overview, instructions to check that everything is installed properly, and a table of contents listing each tutorial section.

What is this all about?

HoloViews is an open-source Python library that makes it simpler to explore your data and communicate the results to others. Compared to other tools, the most important feature of HoloViews is that:

HoloViews lets you work seamlessly with both the data and its graphical representation.

When using HoloViews, the focus is on bundling your data together with the appropriate metadata to support both analysis and plotting, making your raw data and its visualization equally accessible at all times. This tutorial will introduce HoloViews and guide you through the process of building rich, deployable visualizations based on Bokeh, Datashader, and (briefly) matplotlib.

Index and Schedule

This four-hour tutorial is broken down into the following sections:

You will find extensive support material on our website holoviews.org. In particular, you may find these links useful during the tutorial:

  • Reference gallery: Visual reference of all elements and containers, along with some other components
  • Getting started guide: Covers some of the same topics as this tutorial, but without exercises

Getting set up

Please consult the tutorial repository README for instructions on setting up your environment. Here is the condensed version of these instructions for unix-based systems (Linux or Mac OS X):

$ conda env create -f environment.yml
$ source activate hvtutorial
$ cd notebooks

If you have any problems with running these instructions, you can conveniently view the full instructions within this notebook by running the following cell:


In [ ]:
from IPython.core import page
with open('../README.rst', 'r') as f:
    page.page(f.read())

If you created the environment last week, make sure to git pull, activate the hvtutorial environment in the notebooks directory and run:

git pull
conda env update -f ../environment.yml

Now you can launch the notebook server:

$ jupyter notebook --NotebookApp.iopub_data_rate_limit=100000000

Once the environment is set up, the following cell should print '1.8.1':


In [ ]:
import holoviews as hv
hv.__version__

And you should see the HoloViews logo after running the following cell:


In [ ]:
hv.extension('bokeh', 'matplotlib')

The next cell tests the key imports needed for this tutorial:


In [ ]:
import bokeh
import matplotlib
import pandas
import datashader
import dask
import geoviews

Lastly, let's make sure the large taxi dataset is available - instructions for acquiring this dataset may be found in the README:


In [ ]:
import os
if not os.path.isfile('./assets/nyc_taxi.csv'):
    print('Taxi dataset not found.')

The following configuration options are recommended additions to your '~/.holoviews.rc' file as they improve the tutorial experience and will be the default behaviour in future:


In [ ]:
lines = ['import holoviews as hv', 'hv.extension.case_sensitive_completion=True',
         "hv.Dataset.datatype = ['dataframe']+hv.Dataset.datatype"]
print('\n'.join(lines))

If you do not have a holoviews.rc already, simply run the following cell to generate one containing the above lines:


In [ ]:
rcpath = os.path.join(os.path.expanduser('~'), '.holoviews.rc')
if not os.path.isfile(rcpath):
    with open(rcpath, 'w') as f:
        f.write('\n'.join(lines))