# Introduction ¶

Stop plotting your data - annotate your data and let it visualize itself.

HoloViews is a Python library that makes analyzing and visualizing scientific or engineering data much simpler, more intuitive, and more easily reproducible. Without HoloViews, there are typically many steps required before you can see your data, whether you use a GUI interactively or write a function or script to build up a plot. HoloViews instead lets you store your data in an annotated format that is instantly visualizable, with immediate access to both the numeric data and its visualization. For instance, if you wrap a two-dimensional dataset like the fractal below ( mandelbrot.npy ) in a HoloViews  Image  object named  fractal  , you can just type  fractal  to view it as an image in an IPython/Jupyter Notebook . Most importantly, combining it with other objects is now easy -- you can e.g. view it annotated with a horizontal line and a histogram, next to a slice of it from the indicated cross-section, all without writing any plotting code:

In [1]:
import numpy as np
import holoviews as hv
hv.notebook_extension('matplotlib')

((fractal * hv.HLine(y=0)).hist() + fractal.sample(y=0))

HoloViewsJS, MatplotlibJS successfully loaded in this cell.
Out[1]:

The original data always remains available in its native format (accessible via  fractal.data  in this case), but working with the HoloViews object instead lets the data display itself, either alone or alongside or overlaid with other HoloViews objects as shown above. The actual plotting is done using a separate library like matplotlib or bokeh , but all of the HoloViews objects can be used without any plotting library available, so that you can easily create, save, load, and manipulate HoloViews objects from within your own programs for later analysis. HoloViews objects support arbitrarily high dimensions, using continuous, discrete, or categorical indexes and values, with flat or hierarchical organizations, and sparse or dense data formats. The objects can then be flexibly combined, selected, sliced, sorted, sampled, or animated, all by specifying what data you want to see rather than by writing plotting code. The goal is to put the plotting code into the background, as an implementation detail to be written once and reused often, letting you focus clearly on your data in daily work.

## More detailed example ¶

Even extremely complex relationships between data elements can be expressed succinctly in HoloViews, allowing you to explore them with ease:

In [2]:
%%opts Points [scaling_factor=50] Contours (color='w')
dots = np.linspace(-0.45, 0.45, 19)

hv.HoloMap({y: (fractal * hv.Points(fractal.sample([(i,y) for i in dots])) +
fractal.sample(y=y) +
hv.operation.threshold(fractal, level=np.percentile(fractal.sample(y=y).data, 90)) +
hv.operation.contours(fractal, levels=[np.percentile(fractal.sample(y=y).data, 60)]))
for y in np.linspace(-0.3, 0.3, 21)}, kdims=['Y']).collate().cols(2)

Out[2]:

Here in A we have taken the same fractal data and indicated a horizontal cross section using a set of dots with sizes proportional to the underlying data values, illustrating how even a simple annotation can be used to reflect other data of interest. We then add a cross-section curve B , a thresholded version of the data C , and a version of the data with a contour outline overlaid D . The threshold and contour levels used are not fixed, but are calculated as the 90th or 60th percentile of the data values along the selected cross section, using standard Python/NumPy functions. All of this data is then packaged into a single  HoloMap  data structure for a range of cross sections, allowing the data for a particular cross section to be revealed by moving the Y-value slider at right. Even with these complicated interrelationships between data elements, the code still only needs to focus on the data that you want to see, not on the details of the plotting or interactive controls, which are handled by HoloViews and the underlying plotting libraries.

Note that just as the 2D array became a 1D curve automatically by sampling to get the cross section, this entire figure would become a single static frame with no slider bar if you chose a specific  Y  value by re-running with  .select(Y=0.3)  before  .cols(2)  . In fact, there is nothing in the code above that adds the slider bar explicitly -- it appears automatically, just because there is an additional dimension of data (  Y  in this case) that has not been laid out spatially. Additional sliders would appear if there were other dimensions being varied as well, e.g. for parameter-space explorations.

This functionality is designed to complement the IPython/Jupyter Notebook interface, though it can be used just as well separately. This web page and all the HoloViews Tutorials are runnable notebooks, which allow you to interleave text, Python code, and graphical results easily. With HoloViews, you can put a minimum of code in the notebook (typically one or two lines per subfigure), specifying what you would like to see rather than the details of how it should be plotted. HoloViews makes the IPython Notebook a practical solution for both exploratory research (since viewing nearly any chunk of data just takes a line or two of code) and for long-term reproducibility of the work (because both the code and the visualizations are preserved in the notebook file forever, and the data and publishable figures can both easily be exported to an archive on disk). See the Tutorials for detailed examples, and then start enjoying working with your data!

# Installation ¶

HoloViews works with Python 2.7, 3.3, and 3.4 . HoloViews is pure Python, but it also provides optional extensions enabled with  hv.notebook_extension()  above that make it integrate well with Jupyter/IPython Notebook 2 and 3.

The quickest and easiest way to get the latest version of all the recommended packages for working with HoloViews on Linux, Windows, or Mac systems is via the conda command provided by the Anaconda or Miniconda scientific Python distributions:

conda install -c ioam holoviews bokeh


See our installation page if you need other options, including pip installations, additional packages, development versions, and minimal installations. Minimal installations include only Param and Numpy as dependencies, neither of which has any required dependencies, making it simple to generate HoloViews objects from within your own code.

Once you’ve installed HoloViews, you can get started by launching Jupyter Notebook:

jupyter notebook


Now you can download the tutorial notebooks . unzip them somewhere Jupyter Notebook can find them, and then open the Homepage.ipynb tutorial or any of the others in the Notebook. Enjoy exploring your data!

# Contributors ¶

HoloViews is developed by Jean-Luc R. Stevens and Philipp Rudiger , in collaboration with James A. Bednar , with support from Continuum Analytics .

HoloViews is completely open source , available under a BSD license freely for both commercial and non-commercial use. HoloViews is designed to be easily extensible, and contributions from users are welcome and encouraged. In particular, HoloViews components can be combined in an infinite number of ways, and although the tutorials are tested continuously, it is impossible for us to test all other conceivable combinations. Thus we welcome bug reports and feature requests , particularly if they come with test cases showing how to reproduce the bugs and pull requests showing how to fix the bug or implement the feature!