Bokeh Elements

Element s are the basic building blocks for any HoloViews visualization. These are the objects that can be composed together using the various Container types. Here in this overview, we show an example of how to build each of these Element s directly out of Python or Numpy data structures. An even more powerful way to use them is by collecting similar Element s into a HoloMap, as described in Exploring Data , so that you can explore, select, slice, and animate them flexibly, but here we focus on having small, self-contained examples. Complete reference material for each type can be accessed using our documentation system . This tutorial uses the default matplotlib plotting backend; see the Bokeh Elements tutorial for the corresponding bokeh plots.

Element types

This class hierarchy shows each of the Element types. Each type is named for the default or expected way that the underlying data can be visualized. E.g., if your data is wrapped into a Surface object, it will display as a 3D surface by default, whereas the same data embedded in an Image object will display as a 2D raster image. But please note that the specification and implementation for each Element type does not actually include any such visualization -- the name merely serves as a semantic indication that you ordinarily think of the data as being laid out visually in that way. The actual plotting is done by a separate plotting subsystem, while the objects themselves focus on storing your data and the metadata needed to describe and use it.

This separation of data and visualization is described in detail in the Options tutorial , which describes all about how to find out the options available for each Element type and change them if necessary, from either Python or IPython Notebook. When using this tutorial interactively in an IPython/Jupyter notebook session, we suggest adding %output info=True after the call to notebook_extension below, which will pop up a detailed list and explanation of the available options for visualizing each Element type, after that notebook cell is executed. Then, to find out all the options for any of these Element types, just press <Shift-Enter> on the corresponding cell in the live notebook.

The types available:

Element
The base class of all Elements .

Charts:

Curve
A continuous relation between a dependent and an independent variable.
ErrorBars
A collection of x-/y-coordinates with associated error magnitudes.
Spread
Continuous version of ErrorBars.
Area
Area under the curve or between curves.
Bars
Data collected and binned into categories.
Histogram
Data collected and binned in a continuous space using specified bin edges.
BoxWhisker
Distributions of data varying by 0-N key dimensions.
Scatter
Discontinuous collection of points indexed over a single dimension.
Points
Discontinuous collection of points indexed over two dimensions.
VectorField
Cyclic variable (and optional auxiliary data) distributed over two-dimensional space.
Spikes
A collection of horizontal or vertical lines at various locations with fixed height (1D) or variable height (2D).
SideHistogram
Histogram binning data contained by some other Element .

Chart3D Elements:

Surface
Continuous collection of points in a three-dimensional space.
Scatter3D
Discontinuous collection of points in a three-dimensional space.
Trisurface
Continuous but irregular collection of points interpolated into a Surface using Delaunay triangulation.

Raster Elements:

Raster
The base class of all rasters containing two-dimensional arrays.
QuadMesh
Raster type specifying 2D bins with two-dimensional array of values.
HeatMap
Raster displaying sparse, discontinuous data collected in a two-dimensional space.
Image
Raster containing a two-dimensional array covering a continuous space (sliceable).
RGB
Image with 3 (R,G,B) or 4 (R,G,B,Alpha) color channels.
HSV
Image with 3 (Hue, Saturation, Value) or 4 channels.

Tabular Elements:

ItemTable
Ordered collection of key-value pairs (ordered dictionary).
Table
Collection of arbitrary data with arbitrary key and value dimensions.

Annotations:

VLine
Vertical line annotation.
HLine
Horizontal line annotation.
Spline
Bezier spline (arbitrary curves).
Text
Text annotation on an Element .
Arrow
Arrow on an Element with optional text label.

Paths:

Path
Collection of paths.
Contours
Collection of paths, each with an associated value.
Polygons
Collection of filled, closed paths with an associated value.
Bounds
Box specified by corner positions.
Box
Box specified by center position, radius, and aspect ratio.
Ellipse
Ellipse specified by center position, radius, and aspect ratio.

Element

The basic or fundamental types of data that can be visualized.

Element is the base class for all the other HoloViews objects shown in this section.

All Element objects accept data as the first argument to define the contents of that element. In addition to its implicit type, each element object has a group string defining its category, and a label naming this particular item, as described in the Introduction .

When rich display is off, or if no visualization has been defined for that type of Element , the Element is presented with a default textual representation:

In [1]:
import holoviews as hv
hv.notebook_extension(bokeh=True)
hv.Element(None, group='Value', label='Label')