holoviews.element package#

Submodules#

Module contents#

class holoviews.element.Annotation(data, **params)[source]#

Bases: Element2D

An Annotation is a special type of element that is designed to be overlaid on top of any arbitrary 2D element. Annotations have neither key nor value dimensions allowing them to be overlaid over any type of data.

Note that one or more Annotations can be displayed without being overlaid on top of any other data. In such instances (by default) they will be displayed using the unit axis limits (0.0-1.0 in both directions) unless an explicit ‘extents’ parameter is supplied. The extents of the bottom Annotation in the Overlay is used when multiple Annotations are displayed together.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Annotation', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(2, 2), default=[Dimension('x'), Dimension('y')], label='Kdims')

The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.

clone(*args, **overrides)[source]#

Clones the object, overriding data and parameters.

Parameters#

data

New data replacing the existing data

shared_databool, optional

Whether to use existing data

new_typeoptional

Type to cast object to

linkbool, optional

Whether clone should be linked Determines whether Streams and Links attached to original object will be inherited.

*args

Additional arguments to pass to constructor

**overrides

New keyword arguments to pass to constructor

Returns#

Cloned object

dimension_values(dimension, expanded=True, flat=True)[source]#

Return the values along the requested dimension.

Parameters#

dimension

The dimension to return values for

expandedbool, optional

Whether to expand values

flatbool, optional

Whether to flatten array

Returns#

NumPy array of values along the requested dimension

class holoviews.element.Area(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Curve

Area is a Chart element representing the area under a curve or between two curves in a 1D coordinate system. The key dimension represents the location of each coordinate along the x-axis, while the value dimension(s) represent the height of the area or the lower and upper bounds of the area between curves.

Multiple areas may be stacked by overlaying them an passing them to the stack method.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Area', label='Group')

A string describing the data wrapped by the object.

classmethod stack(areas, baseline_name='Baseline')[source]#

Stacks an (Nd)Overlay of Area or Curve Elements by offsetting their baselines. To stack a HoloMap or DynamicMap use the map method.

class holoviews.element.Arrow(x, y, text='', direction='<', points=40, arrowstyle='->', **params)[source]#

Bases: Annotation

Draw an arrow to the given xy position with optional text at distance ‘points’ away. The direction of the arrow may be specified as well as the arrow head style.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Arrow', label='Group')

A string describing the data wrapped by the object.

x = ClassSelector(class_=(<class 'numbers.Number'>, <class 'numpy.datetime64'>, <class 'datetime.datetime'>, <class 'datetime.date'>, <class 'datetime.time'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'pandas.core.dtypes.dtypes.DatetimeTZDtype'>, <class 'pandas._libs.tslibs.period.Period'>, <class 'cftime._cftime.datetime'>), default=0, label='X')

The x-position of the arrow which make be numeric or a timestamp.

y = ClassSelector(class_=(<class 'numbers.Number'>, <class 'numpy.datetime64'>, <class 'datetime.datetime'>, <class 'datetime.date'>, <class 'datetime.time'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'pandas.core.dtypes.dtypes.DatetimeTZDtype'>, <class 'pandas._libs.tslibs.period.Period'>, <class 'cftime._cftime.datetime'>), default=0, label='Y')

The y-position of the arrow which make be numeric or a timestamp.

text = String(default='', label='Text')

Text associated with the arrow.

direction = Selector(default='<', label='Direction', names={}, objects=['<', '^', '>', 'v'])

The cardinal direction in which the arrow is pointing. Accepted arrow directions are ‘<’, ‘^’, ‘>’ and ‘v’.

arrowstyle = Selector(default='->', label='Arrowstyle', names={}, objects=['-', '->', '-[', '-|>', '<->', '<|-|>'])

The arrowstyle used to draw the arrow. Accepted arrow styles are ‘-’, ‘->’, ‘-[’, ‘-|>', '<->' and '<|-|>’

points = Number(default=40, inclusive_bounds=(True, True), label='Points')

Font size of arrow text (if any).

dimension_values(dimension, expanded=True, flat=True)[source]#

Return the values along the requested dimension.

Parameters#

dimension

The dimension to return values for

expandedbool, optional

Whether to expand values

flatbool, optional

Whether to flatten array

Returns#

NumPy array of values along the requested dimension

class holoviews.element.Bars(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Selection1DExpr, Chart

Bars is a Chart element representing categorical observations using the height of rectangular bars. The key dimensions represent the categorical groupings of the data, but may also be used to stack the bars, while the first value dimension represents the height of each bar.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Bars', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(1, 3), default=[Dimension('x')], label='Kdims')

The key dimension(s) of a Chart represent the independent variable(s).

class holoviews.element.Bivariate(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Selection2DExpr, StatisticsElement

Bivariate elements are containers for two dimensional data, which is to be visualized as a kernel density estimate. The data should be supplied in a tabular format of x- and y-columns.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Bivariate', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(2, 2), default=[Dimension('x'), Dimension('y')], label='Kdims')

The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.

vdims = List(bounds=(0, 1), default=[Dimension('Density')], label='Vdims')

The value dimensions defined as the list of dimensions used to describe the components of the data. If multiple value dimensions are supplied, a particular value dimension may be indexed by name after the key dimensions. Aliased with value_dimensions.

class holoviews.element.Bounds(*args, **kwargs)[source]#

Bases: BaseShape

An arbitrary axis-aligned bounding rectangle defined by the (left, bottom, right, top) coordinate positions.

If supplied a single real number as input, this value will be treated as the radius of a square, zero-center box which will be used to compute the corresponding lbrt tuple.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Bounds', label='Group')

The assigned group name.

lbrt = Tuple(default=(-0.5, -0.5, 0.5, 0.5), label='Lbrt', length=4)

The (left, bottom, right, top) coordinates of the bounding box.

class holoviews.element.Box(*args, **kwargs)[source]#

Bases: BaseShape

Draw a centered box of a given width at the given position with the specified aspect ratio (if any).

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Box', label='Group')

The assigned group name.

x = Number(default=0, inclusive_bounds=(True, True), label='X')

The x-position of the box center.

y = Number(default=0, inclusive_bounds=(True, True), label='Y')

The y-position of the box center.

width = Number(default=1, inclusive_bounds=(True, True), label='Width')

The width of the box.

height = Number(default=1, inclusive_bounds=(True, True), label='Height')

The height of the box.

orientation = Number(default=0, inclusive_bounds=(True, True), label='Orientation')

Orientation in the Cartesian coordinate system, the counterclockwise angle in radians between the first axis and the horizontal.

aspect = Number(default=1.0, inclusive_bounds=(True, True), label='Aspect')

Optional multiplier applied to the box size to compute the width in cases where only the length value is set.

class holoviews.element.BoxWhisker(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Selection1DExpr, Dataset, Element2D

BoxWhisker represent data as a distributions highlighting the median, mean and various percentiles. It may have a single value dimension and any number of key dimensions declaring the grouping of each violin.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='BoxWhisker', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(0, None), default=[], label='Kdims')

The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.

vdims = List(bounds=(1, 1), default=[Dimension('y')], label='Vdims')

The value dimensions defined as the list of dimensions used to describe the components of the data. If multiple value dimensions are supplied, a particular value dimension may be indexed by name after the key dimensions. Aliased with value_dimensions.

class holoviews.element.Chord(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Graph

Chord is a special type of Graph which computes the locations of each node on a circle and the chords connecting them. The amount of radial angle devoted to each node and the number of chords are scaled by a weight supplied as a value dimension.

If the values are integers then the number of chords is directly scaled by the value, if the values are floats then the number of chords are apportioned such that the lowest value edge is given one chord and all other nodes are given nodes proportional to their weight.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Chord', label='Group')

A string describing the data wrapped by the object.

property edgepaths#

Returns the fixed EdgePaths or computes direct connections between supplied nodes.

property nodes#

Computes the node positions the first time they are requested if no explicit node information was supplied.

class holoviews.element.Contours(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Path

The Contours element is a subtype of a Path which is characterized by the fact that each path geometry may only be associated with scalar values. It supports all the same data formats as a Path but does not allow continuously varying values along the path geometry’s coordinates. Conceptually Contours therefore represent iso-contours or isoclines, i.e. a function of two variables which describes a curve along which the function has a constant value.

The canonical representation is a list of dictionaries storing the x- and y-coordinates along with any other (scalar) values:

[{‘x’: 1d-array, ‘y’: 1d-array, ‘value’: scalar}, …]

Alternatively Contours also supports a single columnar data-structure to specify an individual contour:

{‘x’: 1d-array, ‘y’: 1d-array, ‘value’: scalar, ‘continuous’: 1d-array}

Since not all formats allow storing scalar values as actual scalars arrays which are the same length as the coordinates but have only one unique value are also considered scalar. This is strictly enforced, ensuring that each path geometry represents a valid iso-contour.

The easiest way of accessing the individual geometries is using the Contours.split method, which returns each path geometry as a separate entity, while the other methods assume a flattened representation where all paths are separated by NaN values.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Contours', label='Group')

A string describing the data wrapped by the object.

vdims = List(bounds=(0, None), constant=True, default=[], label='Vdims')

Contours optionally accept a value dimension, corresponding to the supplied values.

class holoviews.element.Curve(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Selection1DExpr, Chart

Curve is a Chart element representing a line in a 1D coordinate system where the key dimension maps on the line x-coordinate and the first value dimension represents the height of the line along the y-axis.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Curve', label='Group')

A string describing the data wrapped by the object.

class holoviews.element.Dataset(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Element

Dataset provides a general baseclass for Element types that contain structured data and supports a range of data formats.

The Dataset class supports various methods offering a consistent way of working with the stored data regardless of the storage format used. These operations include indexing, selection and various ways of aggregating or collapsing the data with a supplied function.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Dataset', label='Group')

A string describing the data wrapped by the object.

datatype = List(bounds=(0, None), default=['dataframe', 'dictionary', 'grid', 'xarray', 'multitabular', 'spatialpandas', 'dask_spatialpandas', 'dask', 'cuDF', 'array', 'ibis'], label='Datatype')

A priority list of the data types to be used for storage on the .data attribute. If the input supplied to the element constructor cannot be put into the requested format, the next format listed will be used until a suitable format is found (or the data fails to be understood).

add_dimension(dimension, dim_pos, dim_val, vdim=False, **kwargs)[source]#

Adds a dimension and its values to the Dataset

Requires the dimension name or object, the desired position in the key dimensions and a key value scalar or array of values, matching the length or shape of the Dataset.

Parameters#

dimension

Dimension or dimension spec to add

dim_posint

Integer index to insert dimension at

dim_valscalar or ndarray

Dimension value(s) to add

vdim

Disabled, this type does not have value dimensions

**kwargs

Keyword arguments passed to the cloned element

Returns#

Cloned object containing the new dimension

aggregate(dimensions=None, function=None, spreadfn=None, **kwargs)[source]#

Aggregates data on the supplied dimensions.

Aggregates over the supplied key dimensions with the defined function or dim_transform specified as a tuple of the transformed dimension name and dim transform.

Parameters#

dimensions

Dimension(s) to aggregate on Default to all key dimensions

function

Aggregation function or transform to apply Supports both simple functions and dimension transforms

spreadfn

Secondary reduction to compute value spread Useful for computing a confidence interval, spread, or standard deviation.

**kwargs

Keyword arguments either passed to the aggregation function or to create new names for the transformed variables

Returns#

Returns the aggregated Dataset

clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)[source]#

Clones the object, overriding data and parameters.

Parameters#

data

New data replacing the existing data

shared_databool, optional

Whether to use existing data

new_typeoptional

Type to cast object to

linkbool, optional

Whether clone should be linked Determines whether Streams and Links attached to original object will be inherited.

*args

Additional arguments to pass to constructor

**overrides

New keyword arguments to pass to constructor

Returns#

Cloned object

closest(coords=None, **kwargs)[source]#

Snaps coordinate(s) to closest coordinate in Dataset

Parameters#

coords

List of coordinates expressed as tuples

**kwargs

Coordinates defined as keyword pairs

Returns#

List of tuples of the snapped coordinates

Raises#

NotImplementedError

Raised if snapping is not supported

columns(dimensions=None)[source]#

Convert dimension values to a dictionary.

Returns a dictionary of column arrays along each dimension of the element.

Parameters#

dimensions

Dimensions to return as columns

Returns#

Dictionary of arrays for each dimension

compute()[source]#

Computes the data to a data format that stores the daata in memory, e.g. a Dask dataframe or array is converted to a Pandas DataFrame or NumPy array.

Returns#

Dataset with the data stored in in-memory format

property dataset#

The Dataset that this object was created from

dframe(dimensions=None, multi_index=False)[source]#

Convert dimension values to DataFrame.

Returns a pandas dataframe of columns along each dimension, either completely flat or indexed by key dimensions.

Parameters#

dimensions

Dimensions to return as columns

multi_index

Convert key dimensions to (multi-)index

Returns#

DataFrame of columns corresponding to each dimension

dimension_values(dimension, expanded=True, flat=True)[source]#

Return the values along the requested dimension.

Parameters#

dimension

The dimension to return values for

expandedbool, optional

Whether to expand values Whether to return the expanded values, behavior depends on the type of data:

  • Columnar: If false returns unique values

  • Geometry: If false returns scalar values per geometry

  • Gridded: If false returns 1D coordinates

flatbool, optional

Whether to flatten array

Returns#

NumPy array of values along the requested dimension

get_dimension_type(dim)[source]#

Get the type of the requested dimension.

Type is determined by Dimension.type attribute or common type of the dimension values, otherwise None.

Parameters#

dimension

Dimension to look up by name or by index

Returns#

Declared type of values along the dimension

groupby(dimensions=None, container_type=<class 'holoviews.core.spaces.HoloMap'>, group_type=None, dynamic=False, **kwargs)[source]#

Groups object by one or more dimensions

Applies groupby operation over the specified dimensions returning an object of type container_type (expected to be dictionary-like) containing the groups.

Parameters#

dimensions

Dimension(s) to group by

container_type

Type to cast group container to

group_type

Type to cast each group to

dynamic

Whether to return a DynamicMap

**kwargs

Keyword arguments to pass to each group

Returns#

Returns object of supplied container_type containing the groups. If dynamic=True returns a DynamicMap instead.

property iloc#

Returns iloc indexer with support for columnar indexing.

Returns an iloc object providing a convenient interface to slice and index into the Dataset using row and column indices. Allow selection by integer index, slice and list of integer indices and boolean arrays.

Examples :

  • Index the first row and column:

    dataset.iloc[0, 0]

  • Select rows 1 and 2 with a slice:

    dataset.iloc[1:3, :]

  • Select with a list of integer coordinates:

    dataset.iloc[[0, 2, 3]]

map(map_fn, specs=None, clone=True)[source]#

Map a function to all objects matching the specs

Recursively replaces elements using a map function when the specs apply, by default applies to all objects, e.g. to apply the function to all contained Curve objects:

dmap.map(fn, hv.Curve)

Parameters#

map_fn : Function to apply to each object specs : List of specs to match

List of types, functions or type[.group][.label] specs to select objects to return, by default applies to all objects.

clone

Whether to clone the object or transform inplace

Returns#

Returns the object after the map_fn has been applied

property ndloc#

Returns ndloc indexer with support for gridded indexing.

Returns an ndloc object providing nd-array like indexing for gridded datasets. Follows NumPy array indexing conventions, allowing for indexing, slicing and selecting a list of indices on multi-dimensional arrays using integer indices. The order of array indices is inverted relative to the Dataset key dimensions, e.g. an Image with key dimensions ‘x’ and ‘y’ can be indexed with image.ndloc[iy, ix], where iy and ix are integer indices along the y and x dimensions.

Examples :

  • Index value in 2D array:

    dataset.ndloc[3, 1]

  • Slice along y-axis of 2D array:

    dataset.ndloc[2:5, :]

  • Vectorized (non-orthogonal) indexing along x- and y-axes:

    dataset.ndloc[[1, 2, 3], [0, 2, 3]]

options(*args, clone=True, **kwargs)[source]#

Applies simplified option definition returning a new object.

Applies options on an object or nested group of objects in a flat format returning a new object with the options applied. If the options are to be set directly on the object a simple format may be used, e.g.:

obj.options(cmap=’viridis’, show_title=False)

If the object is nested the options must be qualified using a type[.group][.label] specification, e.g.:

obj.options(‘Image’, cmap=’viridis’, show_title=False)

or using:

obj.options({‘Image’: dict(cmap=’viridis’, show_title=False)})

Identical to the .opts method but returns a clone of the object by default.

Parameters#

*args: Sets of options to apply to object

Supports a number of formats including lists of Options objects, a type[.group][.label] followed by a set of keyword options to apply and a dictionary indexed by type[.group][.label] specs.

backendoptional

Backend to apply options to Defaults to current selected backend

clonebool, optional

Whether to clone object Options can be applied inplace with clone=False

**kwargs: Keywords of options

Set of options to apply to the object

Returns#

Returns the cloned object with the options applied

persist()[source]#

Persists the results of a lazy data interface to memory to speed up data manipulation and visualization. If the particular data backend already holds the data in memory this is a no-op. Unlike the compute method this maintains the same data type.

Returns#

Dataset with the data persisted to memory

property pipeline#

Chain operation that evaluates the sequence of operations that was used to create this object, starting with the Dataset stored in dataset property

range(dim, data_range=True, dimension_range=True)[source]#

Return the lower and upper bounds of values along dimension.

Parameters#

dim

The dimension to compute the range on.

data_rangebool

Compute range from data values

dimension_rangebool

Include Dimension ranges Whether to include Dimension range and soft_range in range calculation

Returns#

Tuple containing the lower and upper bound

reduce(dimensions=None, function=None, spreadfn=None, **reductions)[source]#

Applies reduction along the specified dimension(s).

Allows reducing the values along one or more key dimension with the supplied function. Supports two signatures:

Reducing with a list of dimensions, e.g.:

ds.reduce([‘x’], np.mean)

Defining a reduction using keywords, e.g.:

ds.reduce(x=np.mean)

Parameters#

dimensions

Dimension(s) to apply reduction on Defaults to all key dimensions

function

Reduction operation to apply, e.g. numpy.mean

spreadfn

Secondary reduction to compute value spread Useful for computing a confidence interval, spread, or standard deviation.

**reductions

Keyword argument defining reduction Allows reduction to be defined as keyword pair of dimension and function

Returns#

The Dataset after reductions have been applied.

reindex(kdims=None, vdims=None)[source]#

Reindexes Dataset dropping static or supplied kdims

Creates a new object with a reordered or reduced set of key dimensions. By default drops all non-varying key dimensions.x

Parameters#

kdimsoptional

New list of key dimensionsx

vdimsoptional

New list of value dimensions

Returns#

Reindexed object

relabel(label=None, group=None, depth=0)[source]#

Clone object and apply new group and/or label.

Applies relabeling to children up to the supplied depth.

Parameters#

labelstr, optional

New label to apply to returned object

groupstr, optional

New group to apply to returned object

depthint, optional

Depth to which relabel will be applied If applied to container allows applying relabeling to contained objects up to the specified depth

Returns#

Returns relabelled object

sample(samples=None, bounds=None, closest=True, **kwargs)[source]#

Samples values at supplied coordinates.

Allows sampling of element with a list of coordinates matching the key dimensions, returning a new object containing just the selected samples. Supports multiple signatures:

Sampling with a list of coordinates, e.g.:

ds.sample([(0, 0), (0.1, 0.2), …])

Sampling a range or grid of coordinates, e.g.:

1D : ds.sample(3) 2D : ds.sample((3, 3))

Sampling by keyword, e.g.:

ds.sample(x=0)

Parameters#

samples : List of nd-coordinates to sample bounds

Bounds of the region to sample Defined as two-tuple for 1D sampling and four-tuple for 2D sampling.

closest

Whether to snap to closest coordinates

**kwargs

Coordinates specified as keyword pairs Keywords of dimensions and scalar coordinates

Returns#

Element containing the sampled coordinates

select(selection_expr=None, selection_specs=None, **selection)[source]#

Applies selection by dimension name

Applies a selection along the dimensions of the object using keyword arguments. The selection may be narrowed to certain objects using selection_specs. For container objects the selection will be applied to all children as well.

Selections may select a specific value, slice or set of values:

  • value: Scalar values will select rows along with an exact

    match, e.g.:

    ds.select(x=3)

  • slice: Slices may be declared as tuples of the upper and

    lower bound, e.g.:

    ds.select(x=(0, 3))

  • values: A list of values may be selected using a list or

    set, e.g.:

    ds.select(x=[0, 1, 2])

  • predicate expression: A holoviews.dim expression, e.g.:

    from holoviews import dim ds.select(selection_expr=dim(‘x’) % 2 == 0)

Parameters#

selection_exprholoviews.dim predicate expression

specifying selection.

selection_specsList of specs to match on

A list of types, functions, or type[.group][.label] strings specifying which objects to apply the selection on.

**selection: Dictionary declaring selections by dimension

Selections can be scalar values, tuple ranges, lists of discrete values and boolean arrays

Returns#

Returns an Dimensioned object containing the selected data or a scalar if a single value was selected

property shape#

Returns the shape of the data.

sort(by=None, reverse=False)[source]#

Sorts the data by the values along the supplied dimensions.

Parameters#

by

Dimension(s) to sort by

reversebool, optional

Reverse sort order

Returns#

Sorted Dataset

property to#

Returns the conversion interface with methods to convert Dataset

transform(*args, **kwargs)[source]#

Transforms the Dataset according to a dimension transform.

Transforms may be supplied as tuples consisting of the dimension(s) and the dim transform to apply or keyword arguments mapping from dimension(s) to dim transforms. If the arg or kwarg declares multiple dimensions the dim transform should return a tuple of values for each.

A transform may override an existing dimension or add a new one in which case it will be added as an additional value dimension.

Parameters#

args

Specify the output arguments and transforms as a tuple of dimension specs and dim transforms

dropbool

Whether to drop all variables not part of the transform

keep_indexbool
Whether to keep indexes

Whether to apply transform on datastructure with index, e.g. pandas.Series or xarray.DataArray, (important for dask datastructures where index may be required to align datasets).

kwargs

Specify new dimensions in the form new_dim=dim_transform

Returns#

Transformed dataset with new dimensions

class holoviews.element.Dendrogram(*args, **kwargs)[source]#

Bases: Path

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Dendrogram', label='Group')

A string describing the data wrapped by the object.

datatype = List(bounds=(0, None), default=['multitabular'], label='Datatype')

A priority list of the data types to be used for storage on the .data attribute. If the input supplied to the element constructor cannot be put into the requested format, the next format listed will be used until a suitable format is found (or the data fails to be understood).

class holoviews.element.Distribution(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Selection1DExpr, StatisticsElement

Distribution elements provides a representation for a one-dimensional distribution which can be visualized as a kernel density estimate. The data should be supplied in a tabular format and will use the first column.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Distribution', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(1, 1), default=[Dimension('Value')], label='Kdims')

The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.

vdims = List(bounds=(0, 1), default=[Dimension('Density')], label='Vdims')

The value dimensions defined as the list of dimensions used to describe the components of the data. If multiple value dimensions are supplied, a particular value dimension may be indexed by name after the key dimensions. Aliased with value_dimensions.

class holoviews.element.Div(data, **params)[source]#

Bases: Element

The Div element represents a div DOM node in an HTML document defined as a string containing valid HTML.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Div', label='Group')

A string describing the data wrapped by the object.

class holoviews.element.EdgePaths(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Path

EdgePaths is a simple Element representing the paths of edges connecting nodes in a graph.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='EdgePaths', label='Group')

A string describing the data wrapped by the object.

class holoviews.element.Element(data, kdims=None, vdims=None, **params)[source]#

Bases: ViewableElement, Composable, Overlayable

Element is the atomic datastructure used to wrap some data with an associated visual representation, e.g. an element may represent a set of points, an image or a curve. Elements provide a common API for interacting with data of different types and define how the data map to a set of dimensions and how those map to the visual representation.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Element', label='Group')

A string describing the data wrapped by the object.

array(dimensions=None)[source]#

Convert dimension values to columnar array.

Parameters#

dimensions

List of dimensions to return

Returns#

Array of columns corresponding to each dimension

closest(coords, **kwargs)[source]#

Snap list or dict of coordinates to closest position.

Parameters#

coords

List of 1D or 2D coordinates

**kwargs

Coordinates specified as keyword pairs

Returns#

List of tuples of the snapped coordinates

Raises#

NotImplementedError

Raised if snapping is not supported

dframe(dimensions=None, multi_index=False)[source]#

Convert dimension values to DataFrame.

Returns a pandas dataframe of columns along each dimension, either completely flat or indexed by key dimensions.

Parameters#

dimensions

Dimensions to return as columns

multi_index

Convert key dimensions to (multi-)index

Returns#

DataFrame of columns corresponding to each dimension

hist(dimension=None, num_bins=20, bin_range=None, adjoin=True, **kwargs)[source]#

Computes and adjoins histogram along specified dimension(s).

Defaults to first value dimension if present otherwise falls back to first key dimension.

Parameters#

dimension

Dimension(s) to compute histogram on

num_binsint, optional

Number of bins

bin_rangetuple, optional

Lower and upper bounds of bins

adjoinbool, optional

Whether to adjoin histogram

Returns#

AdjointLayout of element and histogram or just the histogram

reduce(dimensions=None, function=None, spreadfn=None, **reduction)[source]#

Applies reduction along the specified dimension(s).

Allows reducing the values along one or more key dimension with the supplied function. Supports two signatures:

Reducing with a list of dimensions, e.g.:

ds.reduce([‘x’], np.mean)

Defining a reduction using keywords, e.g.:

ds.reduce(x=np.mean)

Parameters#

dimensions

Dimension(s) to apply reduction on Defaults to all key dimensions

function

Reduction operation to apply, e.g. numpy.mean

spreadfn

Secondary reduction to compute value spread Useful for computing a confidence interval, spread, or standard deviation.

**reductions

Keyword argument defining reduction Allows reduction to be defined as keyword pair of dimension and function

Returns#

The element after reductions have been applied.

sample(samples=None, bounds=None, closest=False, **sample_values)[source]#

Samples values at supplied coordinates.

Allows sampling of element with a list of coordinates matching the key dimensions, returning a new object containing just the selected samples. Supports multiple signatures:

Sampling with a list of coordinates, e.g.:

ds.sample([(0, 0), (0.1, 0.2), …])

Sampling a range or grid of coordinates, e.g.:

1D : ds.sample(3) 2D : ds.sample((3, 3))

Sampling by keyword, e.g.:

ds.sample(x=0)

Parameters#

samples

List of nd-coordinates to sample

bounds

Bounds of the region to sample Defined as two-tuple for 1D sampling and four-tuple for 2D sampling.

closest

Whether to snap to closest coordinates

**kwargs

Coordinates specified as keyword pairs Keywords of dimensions and scalar coordinates

Returns#

Element containing the sampled coordinates

class holoviews.element.Ellipse(*args, **kwargs)[source]#

Bases: BaseShape

Draw an axis-aligned ellipse at the specified x,y position with the given orientation.

The simplest (default) Ellipse is a circle, specified using:

Ellipse(x,y, diameter)

A circle is a degenerate ellipse where the width and height are equal. To specify these explicitly, you can use:

Ellipse(x,y, (width, height))

There is also an aspect parameter allowing you to generate an ellipse by specifying a multiplicating factor that will be applied to the height only.

Note that as a subclass of Path, internally an Ellipse is a sequence of (x,y) sample positions. Ellipse could also be implemented as an annotation that uses a dedicated ellipse artist.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Ellipse', label='Group')

The assigned group name.

x = Number(default=0, inclusive_bounds=(True, True), label='X')

The x-position of the ellipse center.

y = Number(default=0, inclusive_bounds=(True, True), label='Y')

The y-position of the ellipse center.

width = Number(default=1, inclusive_bounds=(True, True), label='Width')

The width of the ellipse.

height = Number(default=1, inclusive_bounds=(True, True), label='Height')

The height of the ellipse.

orientation = Number(default=0, inclusive_bounds=(True, True), label='Orientation')

Orientation in the Cartesian coordinate system, the counterclockwise angle in radians between the first axis and the horizontal.

aspect = Number(default=1.0, inclusive_bounds=(True, True), label='Aspect')

Optional multiplier applied to the diameter to compute the width in cases where only the diameter value is set.

samples = Number(default=100, inclusive_bounds=(True, True), label='Samples')

The sample count used to draw the ellipse.

class holoviews.element.ErrorBars(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Selection1DExpr, Chart

ErrorBars is a Chart element representing error bars in a 1D coordinate system where the key dimension corresponds to the location along the x-axis and the first value dimension corresponds to the location along the y-axis and one or two extra value dimensions corresponding to the symmetric or asymmetric errors either along x-axis or y-axis. If two value dimensions are given, then the last value dimension will be taken as symmetric errors. If three value dimensions are given then the last two value dimensions will be taken as negative and positive errors. By default the errors are defined along y-axis. A parameter horizontal, when set True, will define the errors along the x-axis.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='ErrorBars', label='Group')

A string describing the quantity measured by the ErrorBars object.

vdims = List(bounds=(1, None), constant=True, default=[Dimension('y'), Dimension('yerror')], label='Vdims')

The value dimensions of the Chart, usually corresponding to a number of dependent variables.

horizontal = Boolean(default=False, label='Horizontal')

Whether the errors are along y-axis (vertical) or x-axis.

range(dim, data_range=True, dimension_range=True)[source]#

Return the lower and upper bounds of values along dimension.

Range of the y-dimension includes the symmetric or asymmetric error.

Parameters#

dimension

The dimension to compute the range on.

data_rangebool

Compute range from data values

dimension_rangebool

Include Dimension ranges Whether to include Dimension range and soft_range in range calculation

Returns#

Tuple containing the lower and upper bound

class holoviews.element.Graph(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Dataset, Element2D

Graph is high-level Element representing both nodes and edges. A Graph may be defined in an abstract form representing just the abstract edges between nodes and optionally may be made concrete by supplying a Nodes Element defining the concrete positions of each node. If the node positions are supplied the EdgePaths (defining the concrete edges) can be inferred automatically or supplied explicitly.

The constructor accepts regular columnar data defining the edges or a tuple of the abstract edges and nodes, or a tuple of the abstract edges, nodes, and edgepaths.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Graph', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(2, 2), default=[Dimension('start'), Dimension('end')], label='Kdims')

The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.

clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)[source]#

Clones the object, overriding data and parameters.

Parameters#

data

New data replacing the existing data

shared_databool, optional

Whether to use existing data

new_typeoptional

Type to cast object to

linkbool, optional

Whether clone should be linked Determines whether Streams and Links attached to original object will be inherited.

*args

Additional arguments to pass to constructor

**overrides

New keyword arguments to pass to constructor

Returns#

Cloned object

dimensions(selection='all', label=False)[source]#

Lists the available dimensions on the object

Provides convenient access to Dimensions on nested Dimensioned objects. Dimensions can be selected by their type, i.e. ‘key’ or ‘value’ dimensions. By default ‘all’ dimensions are returned.

Parameters#

selectionType of dimensions to return

The type of dimension, i.e. one of ‘key’, ‘value’, ‘constant’ or ‘all’.

labelWhether to return the name, label or Dimension

Whether to return the Dimension objects (False), the Dimension names (True/’name’) or labels (‘label’).

Returns#

List of Dimension objects or their names or labels

edge_type[source]#

alias of EdgePaths

property edgepaths#

Returns the fixed EdgePaths or computes direct connections between supplied nodes.

classmethod from_networkx(G, positions, nodes=None, **kwargs)[source]#

Generate a HoloViews Graph from a networkx.Graph object and networkx layout function or dictionary of node positions. Any keyword arguments will be passed to the layout function. By default it will extract all node and edge attributes from the networkx.Graph but explicit node information may also be supplied. Any non-scalar attributes, such as lists or dictionaries will be ignored.

Parameters#

Gnetworkx.Graph

Graph to convert to Graph element

positionsdict or callable

Node positions Node positions defined as a dictionary mapping from node id to (x, y) tuple or networkx layout function which computes a positions dictionary

kwargsdict

Keyword arguments for layout function

Returns#

Graph element

node_type[source]#

alias of Nodes

property nodes#

Computes the node positions the first time they are requested if no explicit node information was supplied.

range(dimension, data_range=True, dimension_range=True)[source]#

Return the lower and upper bounds of values along dimension.

Parameters#

dim

The dimension to compute the range on.

data_rangebool

Compute range from data values

dimension_rangebool

Include Dimension ranges Whether to include Dimension range and soft_range in range calculation

Returns#

Tuple containing the lower and upper bound

select(selection_expr=None, selection_specs=None, selection_mode='edges', **selection)[source]#

Allows selecting data by the slices, sets and scalar values along a particular dimension. The indices should be supplied as keywords mapping between the selected dimension and value. Additionally selection_specs (taking the form of a list of type.group.label strings, types or functions) may be supplied, which will ensure the selection is only applied if the specs match the selected object.

Selecting by a node dimensions selects all edges and nodes that are connected to the selected nodes. To select only edges between the selected nodes set the selection_mode to ‘nodes’.

class holoviews.element.HLine(y, **params)[source]#

Bases: Annotation

Horizontal line annotation at the given position.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='HLine', label='Group')

A string describing the data wrapped by the object.

y = ClassSelector(class_=(<class 'numbers.Number'>, <class 'numpy.datetime64'>, <class 'datetime.datetime'>, <class 'datetime.date'>, <class 'datetime.time'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'pandas.core.dtypes.dtypes.DatetimeTZDtype'>, <class 'pandas._libs.tslibs.period.Period'>, <class 'cftime._cftime.datetime'>), default=0, label='Y')

The y-position of the HLine which make be numeric or a timestamp.

dimension_values(dimension, expanded=True, flat=True)[source]#

Return the values along the requested dimension.

Parameters#

dimension

The dimension to return values for

expandedbool, optional

Whether to expand values

flatbool, optional

Whether to flatten array

Returns#

NumPy array of values along the requested dimension

class holoviews.element.HLines(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: VectorizedAnnotation

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='HLines', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(1, 1), default=[Dimension('y')], label='Kdims')

The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.

class holoviews.element.HSV(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: RGB

HSV represents a regularly spaced 2D grid of an underlying continuous space of HSV (hue, saturation and value) color space values. The definition of the grid closely matches the semantics of an Image or RGB element and in the simplest case the grid may be specified as a NxMx3 or NxMx4 array of values along with a bounds, but it may also be defined through explicit and regularly spaced x/y-coordinate arrays. The two most basic supported constructors of an HSV element therefore include:

HSV((X, Y, H, S, V))

where X is a 1D array of shape M, Y is a 1D array of shape N and H/S/V are 2D array of shape NxM, or equivalently:

HSV(Z, bounds=(x0, y0, x1, y1))

where Z is a 3D array of stacked H/S/V arrays with shape NxMx3/4 and the bounds define the (left, bottom, top, right) edges of the four corners of the grid. Other gridded formats which support declaring of explicit x/y-coordinate arrays such as xarray are also supported.

Note that the interpretation of the orientation changes depending on whether bounds or explicit coordinates are used.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='HSV', label='Group')

A string describing the data wrapped by the object.

vdims = List(bounds=(3, 4), default=[Dimension('H'), Dimension('S'), Dimension('V')], label='Vdims')

The dimension description of the data held in the array. If an alpha channel is supplied, the defined alpha_dimension is automatically appended to this list.

alpha_dimension = ClassSelector(class_=<class 'holoviews.core.dimension.Dimension'>, default=Dimension('A'), label='Alpha dimension')

The alpha dimension definition to add the value dimensions if an alpha channel is supplied.

property rgb#

Conversion from HSV to RGB.

class holoviews.element.HSpan(y1=None, y2=None, **params)[source]#

Bases: Annotation

Horizontal span annotation at the given position.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='HSpan', label='Group')

A string describing the data wrapped by the object.

y1 = ClassSelector(allow_None=True, class_=(<class 'numbers.Number'>, <class 'numpy.datetime64'>, <class 'datetime.datetime'>, <class 'datetime.date'>, <class 'datetime.time'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'pandas.core.dtypes.dtypes.DatetimeTZDtype'>, <class 'pandas._libs.tslibs.period.Period'>, <class 'cftime._cftime.datetime'>), default=0, label='Y1')

The start y-position of the VSpan which must be numeric or a timestamp.

y2 = ClassSelector(allow_None=True, class_=(<class 'numbers.Number'>, <class 'numpy.datetime64'>, <class 'datetime.datetime'>, <class 'datetime.date'>, <class 'datetime.time'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'pandas.core.dtypes.dtypes.DatetimeTZDtype'>, <class 'pandas._libs.tslibs.period.Period'>, <class 'cftime._cftime.datetime'>), default=0, label='Y2')

The end y-position of the VSpan which must be numeric or a timestamp.

dimension_values(dimension, expanded=True, flat=True)[source]#

Return the values along the requested dimension.

Parameters#

dimension

The dimension to return values for

expandedbool, optional

Whether to expand values

flatbool, optional

Whether to flatten array

Returns#

NumPy array of values along the requested dimension

class holoviews.element.HSpans(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: VectorizedAnnotation

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='HSpans', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(2, 2), default=[Dimension('y0'), Dimension('y1')], label='Kdims')

The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.

class holoviews.element.HeatMap(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Selection2DExpr, Dataset, Element2D

HeatMap represents a 2D grid of categorical coordinates which can be computed from a sparse tabular representation. A HeatMap does not automatically aggregate the supplied values, so if the data contains multiple entries for the same coordinate on the 2D grid it should be aggregated using the aggregate method before display.

The HeatMap constructor will support any tabular or gridded data format with 2 coordinates and at least one value dimension. A simple example:

HeatMap([(x1, y1, z1), (x2, y2, z2), …])

However any tabular and gridded format, including pandas DataFrames, dictionaries of columns, xarray DataArrays and more are supported if the library is importable.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='HeatMap', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(2, 2), constant=True, default=[Dimension('x'), Dimension('y')], label='Kdims')

The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.

vdims = List(bounds=(0, None), constant=True, default=[Dimension('z')], label='Vdims')

The value dimensions defined as the list of dimensions used to describe the components of the data. If multiple value dimensions are supplied, a particular value dimension may be indexed by name after the key dimensions. Aliased with value_dimensions.

range(dim, data_range=True, dimension_range=True)[source]#

Return the lower and upper bounds of values along dimension.

Parameters#

dimension

The dimension to compute the range on.

data_rangebool

Compute range from data values

dimension_rangebool

Include Dimension ranges Whether to include Dimension range and soft_range in range calculation

Returns#

Tuple containing the lower and upper bound

class holoviews.element.HexTiles(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Selection2DExpr, Dataset, Element2D

HexTiles is a statistical element with a visual representation that renders a density map of the data values as a hexagonal grid.

Before display the data is aggregated either by counting the values in each hexagonal bin or by computing aggregates.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='HexTiles', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(2, 2), default=[Dimension('x'), Dimension('y')], label='Kdims')

The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.

class holoviews.element.Histogram(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Selection1DExpr, Chart

Histogram is a Chart element representing a number of bins in a 1D coordinate system. The key dimension represents the binned values, which may be declared as bin edges or bin centers, while the value dimensions usually defines a count, frequency or density associated with each bin.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Histogram', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(1, 1), default=[Dimension('x')], label='Kdims')

Dimensions on Element2Ds determine the number of indexable dimensions.

vdims = List(bounds=(1, None), default=[Dimension('Frequency')], label='Vdims')

The value dimensions of the Chart, usually corresponding to a number of dependent variables.

datatype = List(bounds=(0, None), default=['grid'], label='Datatype')

A priority list of the data types to be used for storage on the .data attribute. If the input supplied to the element constructor cannot be put into the requested format, the next format listed will be used until a suitable format is found (or the data fails to be understood).

property edges#

Property to access the Histogram edges provided for backward compatibility

class holoviews.element.Image(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Selection2DExpr, Dataset, Raster, SheetCoordinateSystem

Image represents a regularly sampled 2D grid of an underlying continuous space of intensity values, which will be colormapped on plotting. The grid of intensity values may be specified as a NxM sized array of values along with a bounds, but it may also be defined through explicit and regularly spaced x/y-coordinate arrays of shape M and N respectively. The two most basic supported constructors of an Image therefore include:

Image((X, Y, Z))

where X is a 1D array of shape M, Y is a 1D array of shape N and Z is a 2D array of shape NxM, or equivalently:

Image(Z, bounds=(x0, y0, x1, y1))

where Z is a 2D array of shape NxM defining the intensity values and the bounds define the (left, bottom, top, right) edges of four corners of the grid. Other gridded formats which support declaring of explicit x/y-coordinate arrays such as xarray are also supported.

Note that the interpretation of the orientation of the array changes depending on whether bounds or explicit coordinates are used.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Image', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(2, 2), constant=True, default=[Dimension('x'), Dimension('y')], label='Kdims')

The label of the x- and y-dimension of the Raster in the form of a string or dimension object.

vdims = List(bounds=(1, None), default=[Dimension('z')], label='Vdims')

The dimension description of the data held in the matrix.

datatype = List(bounds=(0, None), default=['grid', 'xarray', 'image', 'cube', 'dataframe', 'dictionary'], label='Datatype')

A priority list of the data types to be used for storage on the .data attribute. If the input supplied to the element constructor cannot be put into the requested format, the next format listed will be used until a suitable format is found (or the data fails to be understood).

bounds = ClassSelector(class_=<class 'holoviews.core.boundingregion.BoundingRegion'>, default=BoundingBox(radius=0.5), label='Bounds')

The bounding region in sheet coordinates containing the data.

rtol = Number(allow_None=True, inclusive_bounds=(True, True), label='Rtol')

The tolerance used to enforce regular sampling for regular, gridded data where regular sampling is expected. Expressed as the maximal allowable sampling difference between sample locations.

aggregate(dimensions=None, function=None, spreadfn=None, **kwargs)[source]#

Aggregates data on the supplied dimensions.

Aggregates over the supplied key dimensions with the defined function or dim_transform specified as a tuple of the transformed dimension name and dim transform.

Parameters#

dimensions

Dimension(s) to aggregate on Default to all key dimensions

function

Aggregation function or transform to apply Supports both simple functions and dimension transforms

spreadfn

Secondary reduction to compute value spread Useful for computing a confidence interval, spread, or standard deviation.

**kwargs

Keyword arguments either passed to the aggregation function or to create new names for the transformed variables

Returns#

Returns the aggregated Dataset

clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)[source]#

Returns a clone of the object with matching parameter values containing the specified args and kwargs.

If shared_data is set to True and no data explicitly supplied, the clone will share data with the original. May also supply a new_type, which will inherit all shared parameters.

closest(coords=None, **kwargs)[source]#

Given a single coordinate or multiple coordinates as a tuple or list of tuples or keyword arguments matching the dimension closest will find the closest actual x/y coordinates.

range(dim, data_range=True, dimension_range=True)[source]#

Return the lower and upper bounds of values along dimension.

Parameters#

dim

The dimension to compute the range on.

data_rangebool

Compute range from data values

dimension_rangebool

Include Dimension ranges Whether to include Dimension range and soft_range in range calculation

Returns#

Tuple containing the lower and upper bound

select(selection_specs=None, **selection)[source]#

Allows selecting data by the slices, sets and scalar values along a particular dimension. The indices should be supplied as keywords mapping between the selected dimension and value. Additionally selection_specs (taking the form of a list of type.group.label strings, types or functions) may be supplied, which will ensure the selection is only applied if the specs match the selected object.

class holoviews.element.ImageStack(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Image

ImageStack expands the capabilities of Image to by supporting multiple layers of images.

As there is many ways to represent multiple layers of images, the following options are supported:

  1. A 3D Numpy array with the shape (y, x, level)

  2. A list of 2D Numpy arrays with identical shape (y, x)

  3. A dictionary where the keys will be set as the vdims and the

    values are 2D Numpy arrays with identical shapes (y, x). If the dictionary’s keys matches the kdims of the element, they need to be 1D arrays.

  4. A tuple containing (x, y, level_0, level_1, …),

    where the level is a 2D Numpy array in the shape of (y, x).

  5. An xarray DataArray or Dataset where its coords contain the kdims.

If no kdims are supplied, x and y are used.

If no vdims are supplied, and the naming can be inferred like with a dictionary the levels will be named level_0, level_1, etc.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='ImageStack', label='Group')

A string describing the data wrapped by the object.

vdims = List(bounds=(1, None), default=[Dimension('z')], label='Vdims')

The dimension description of the data held in the matrix.

class holoviews.element.ItemTable(data, **params)[source]#

Bases: Element

A tabular element type to allow convenient visualization of either a standard Python dictionary or a list of tuples (i.e. input suitable for an dict constructor). Tables store heterogeneous data with different labels.

Dimension objects are also accepted as keys, allowing dimensional information (e.g. type and units) to be associated per heading.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='ItemTable', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(0, 0), default=[], label='Kdims')

ItemTables hold an index Dimension for each value they contain, i.e. they are equivalent to the keys.

vdims = List(bounds=(0, None), default=[Dimension('Default')], label='Vdims')

ItemTables should have only index Dimensions.

cell_type(row, col)[source]#

Returns the cell type given a row and column index. The common basic cell types are ‘data’ and ‘heading’.

dimension_values(dimension, expanded=True, flat=True)[source]#

Return the values along the requested dimension.

Parameters#

dimension

The dimension to return values for

expandedbool, optional

Whether to expand values Whether to return the expanded values, behavior depends on the type of data:

  • Columnar

    If false returns unique values

  • Geometry

    If false returns scalar values per geometry

  • Gridded

    If false returns 1D coordinates

flatbool, optional

Whether to flatten array

Returns#

NumPy array of values along the requested dimension

hist(*args, **kwargs)[source]#

Computes and adjoins histogram along specified dimension(s).

Defaults to first value dimension if present otherwise falls back to first key dimension.

Parameters#

dimension

Dimension(s) to compute histogram on

num_binsint, optional

Number of bins

bin_rangetuple, optional

Lower and upper bounds of bins

adjoinbool, optional

Whether to adjoin histogram

Returns#

AdjointLayout of element and histogram or just the histogram

pprint_cell(row, col)[source]#

Get the formatted cell value for the given row and column indices.

reduce(dimensions=None, function=None, **reduce_map)[source]#

Applies reduction along the specified dimension(s).

Allows reducing the values along one or more key dimension with the supplied function. Supports two signatures:

Reducing with a list of dimensions, e.g.:

ds.reduce([‘x’], np.mean)

Defining a reduction using keywords, e.g.:

ds.reduce(x=np.mean)

Parameters#

dimensions

Dimension(s) to apply reduction on Defaults to all key dimensions

function

Reduction operation to apply, e.g. numpy.mean

spreadfn

Secondary reduction to compute value spread Useful for computing a confidence interval, spread, or standard deviation.

**reductions

Keyword argument defining reduction Allows reduction to be defined as keyword pair of dimension and function

Returns#

The element after reductions have been applied.

sample(samples=None)[source]#

Samples values at supplied coordinates.

Allows sampling of element with a list of coordinates matching the key dimensions, returning a new object containing just the selected samples. Supports multiple signatures:

Sampling with a list of coordinates, e.g.:

ds.sample([(0, 0), (0.1, 0.2), …])

Sampling a range or grid of coordinates, e.g.:

1D : ds.sample(3) 2D : ds.sample((3, 3))

Sampling by keyword, e.g.:

ds.sample(x=0)

Parameters#

samples

List of nd-coordinates to sample

bounds

Bounds of the region to sample Defined as two-tuple for 1D sampling and four-tuple for 2D sampling.

closest

Whether to snap to closest coordinates

**kwargs

Coordinates specified as keyword pairs Keywords of dimensions and scalar coordinates

Returns#

Element containing the sampled coordinates

class holoviews.element.Labels(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Dataset, Element2D

Labels represents a collection of text labels associated with 2D coordinates. Unlike the Text annotation, Labels is a Dataset type which allows drawing vectorized labels from tabular or gridded data.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Labels', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(2, 2), constant=True, default=[Dimension('x'), Dimension('y')], label='Kdims')

The label of the x- and y-dimension of the Labels element in form of a string or dimension object.

vdims = List(bounds=(1, None), default=[Dimension('Label')], label='Vdims')

Defines the value dimension corresponding to the label text.

class holoviews.element.Nodes(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Points

Nodes is a simple Element representing Graph nodes as a set of Points. Unlike regular Points, Nodes must define a third key dimension corresponding to the node index.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Nodes', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(3, 3), default=[Dimension('x'), Dimension('y'), Dimension('index')], label='Kdims')

The key dimensions of a geometry represent the x- and y- coordinates in a 2D space.

class holoviews.element.Path(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: SelectionPolyExpr, Geometry

The Path element represents one or more of path geometries with associated values. Each path geometry may be split into sub-geometries on NaN-values and may be associated with scalar values or array values varying along its length. In analogy to GEOS geometry types a Path is a collection of LineString and MultiLineString geometries with associated values.

Like all other elements a Path may be defined through an extensible list of interfaces. Natively, HoloViews provides the MultiInterface which allows representing paths as lists of regular columnar data objects including arrays, dataframes and dictionaries of column arrays and scalars.

The canonical representation is a list of dictionaries storing the x- and y-coordinates along with any other values:

[{‘x’: 1d-array, ‘y’: 1d-array, ‘value’: scalar, ‘continuous’: 1d-array}, …]

Alternatively Path also supports a single columnar data-structure to specify an individual path:

{‘x’: 1d-array, ‘y’: 1d-array, ‘value’: scalar, ‘continuous’: 1d-array}

Both scalar values and values continuously varying along the geometries coordinates a Path may be used vary visual properties of the paths such as the color. Since not all formats allow storing scalar values as actual scalars, arrays that are the same length as the coordinates but have only one unique value are also considered scalar.

The easiest way of accessing the individual geometries is using the Path.split method, which returns each path geometry as a separate entity, while the other methods assume a flattened representation where all paths are separated by NaN values.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Path', label='Group')

A string describing the data wrapped by the object.

datatype = List(bounds=(0, None), default=['multitabular', 'spatialpandas', 'dask_spatialpandas'], label='Datatype')

A priority list of the data types to be used for storage on the .data attribute. If the input supplied to the element constructor cannot be put into the requested format, the next format listed will be used until a suitable format is found (or the data fails to be understood).

select(selection_expr=None, selection_specs=None, **selection)[source]#

Applies selection by dimension name

Applies a selection along the dimensions of the object using keyword arguments. The selection may be narrowed to certain objects using selection_specs. For container objects the selection will be applied to all children as well.

Selections may select a specific value, slice or set of values:

  • value: Scalar values will select rows along with an exact

    match, e.g.:

    ds.select(x=3)

  • slice: Slices may be declared as tuples of the upper and

    lower bound, e.g.:

    ds.select(x=(0, 3))

  • values: A list of values may be selected using a list or

    set, e.g.:

    ds.select(x=[0, 1, 2])

  • predicate expression: A holoviews.dim expression, e.g.:

    from holoviews import dim ds.select(selection_expr=dim(‘x’) % 2 == 0)

Parameters#

selection_exprholoviews.dim predicate expression

specifying selection.

selection_specsList of specs to match on

A list of types, functions, or type[.group][.label] strings specifying which objects to apply the selection on.

**selection: Dictionary declaring selections by dimension

Selections can be scalar values, tuple ranges, lists of discrete values and boolean arrays

Returns#

Returns an Dimensioned object containing the selected data or a scalar if a single value was selected

split(start=None, end=None, datatype=None, **kwargs)[source]#

The split method allows splitting a Path type into a list of subpaths of the same type. A start and/or end may be supplied to select a subset of paths.

class holoviews.element.Path3D(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Element3D, Path

Path3D is a 3D element representing a line through 3D space. The key dimensions represent the position of each coordinate along the x-, y- and z-axis while the value dimensions can optionally supply additional information.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Path3D', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(3, 3), default=[Dimension('x'), Dimension('y'), Dimension('z')], label='Kdims')

The key dimensions of a geometry represent the x- and y- coordinates in a 2D space.

vdims = List(bounds=(0, None), default=[], label='Vdims')

Path3D can have optional value dimensions.

class holoviews.element.Points(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Selection2DExpr, Geometry

Points represents a set of coordinates in 2D space, which may optionally be associated with any number of value dimensions.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Points', label='Group')

A string describing the data wrapped by the object.

class holoviews.element.Polygons(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Contours

The Polygons element represents one or more polygon geometries with associated scalar values. Each polygon geometry may be split into sub-geometries on NaN-values and may be associated with scalar values. In analogy to GEOS geometry types a Polygons element is a collection of Polygon and MultiPolygon geometries. Polygon geometries are defined as a set of coordinates describing the exterior bounding ring and any number of interior holes.

Like all other elements a Polygons element may be defined through an extensible list of interfaces. Natively HoloViews provides the MultiInterface which allows representing paths as lists of regular columnar data objects including arrays, dataframes and dictionaries of column arrays and scalars.

The canonical representation is a list of dictionaries storing the x- and y-coordinates, a list-of-lists of arrays representing the holes, along with any other values:

[{‘x’: 1d-array, ‘y’: 1d-array, ‘holes’: list-of-lists-of-arrays, ‘value’: scalar}, …]

Alternatively Polygons also supports a single columnar data-structure to specify an individual polygon:

{‘x’: 1d-array, ‘y’: 1d-array, ‘holes’: list-of-lists-of-arrays, ‘value’: scalar}

The list-of-lists format of the holes corresponds to the potential for each coordinate array to be split into a multi-geometry through NaN-separators. Each sub-geometry separated by the NaNs therefore has an unambiguous mapping to a list of holes. If a (multi-)polygon has no holes, the ‘holes’ key may be omitted.

Any value dimensions stored on a Polygons geometry must be scalar, just like the Contours element. Since not all formats allow storing scalar values as actual scalars arrays which are the same length as the coordinates but have only one unique value are also considered scalar.

The easiest way of accessing the individual geometries is using the Polygons.split method, which returns each path geometry as a separate entity, while the other methods assume a flattened representation where all paths are separated by NaN values.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Polygons', label='Group')

A string describing the data wrapped by the object.

vdims = List(bounds=(0, None), default=[], label='Vdims')

Polygons optionally accept a value dimension, corresponding to the supplied value.

property has_holes#

Detects whether any polygon in the Polygons element defines holes. Useful to avoid expanding Polygons unless necessary.

holes()[source]#

Returns a list-of-lists-of-lists of hole arrays. The three levels of nesting reflects the structure of the polygons:

  1. The first level of nesting corresponds to the list of geometries

  2. The second level corresponds to each Polygon in a MultiPolygon

  3. The third level of nesting allows for multiple holes per Polygon

class holoviews.element.QuadMesh(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Selection2DExpr, Dataset, Element2D

A QuadMesh represents 2D rectangular grid expressed as x- and y-coordinates defined as 1D or 2D arrays. Unlike the Image type a QuadMesh may be regularly or irregularly spaced and contain either bin edges or bin centers. If bin edges are supplied the shape of the x/y-coordinate arrays should be one greater than the shape of the value array.

The default interface expects data to be specified in the form:

QuadMesh((X, Y, Z))

where X and Y may be 1D or 2D arrays of the shape N(+1) and M(+1) respectively or N(+1)xM(+1) and the Z value array should be of shape NxM. Other gridded formats such as xarray are also supported if installed.

The grid orientation follows the standard matrix convention: An array Z with shape (nrows, ncolumns) is plotted with the column number as X and the row number as Y.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='QuadMesh', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(2, 2), constant=True, default=[Dimension('x'), Dimension('y')], label='Kdims')

The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.

vdims = List(bounds=(1, None), default=[Dimension('z')], label='Vdims')

The value dimensions defined as the list of dimensions used to describe the components of the data. If multiple value dimensions are supplied, a particular value dimension may be indexed by name after the key dimensions. Aliased with value_dimensions.

trimesh()[source]#

Converts a QuadMesh into a TriMesh.

class holoviews.element.RGB(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Image

RGB represents a regularly spaced 2D grid of an underlying continuous space of RGB(A) (red, green, blue and alpha) color space values. The definition of the grid closely matches the semantics of an Image and in the simplest case the grid may be specified as a NxMx3 or NxMx4 array of values along with a bounds, but it may also be defined through explicit and regularly spaced x/y-coordinate arrays. The two most basic supported constructors of an RGB element therefore include:

RGB((X, Y, R, G, B))

where X is a 1D array of shape M, Y is a 1D array of shape N and R/G/B are 2D array of shape NxM, or equivalently:

RGB(Z, bounds=(x0, y0, x1, y1))

where Z is a 3D array of stacked R/G/B arrays with shape NxMx3/4 and the bounds define the (left, bottom, top, right) edges of the four corners of the grid. Other gridded formats which support declaring of explicit x/y-coordinate arrays such as xarray are also supported.

Note that the interpretation of the orientation changes depending on whether bounds or explicit coordinates are used.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='RGB', label='Group')

A string describing the data wrapped by the object.

vdims = List(bounds=(3, 4), default=[Dimension('R'), Dimension('G'), Dimension('B')], label='Vdims')

The dimension description of the data held in the matrix. If an alpha channel is supplied, the defined alpha_dimension is automatically appended to this list.

alpha_dimension = ClassSelector(class_=<class 'holoviews.core.dimension.Dimension'>, default=Dimension('A'), label='Alpha dimension')

The alpha dimension definition to add the value dimensions if an alpha channel is supplied.

classmethod load_image(filename, height=1, array=False, bounds=None, bare=False, **kwargs)[source]#

Load an image from a file and return an RGB element or array

Parameters#

filename

Filename of the image to be loaded

height

Determines the bounds of the image where the width is scaled relative to the aspect ratio of the image.

array

Whether to return an array (rather than RGB default)

bounds

Bounds for the returned RGB (overrides height)

bare

Whether to hide the axes

kwargs

Additional kwargs to the RGB constructor

Returns#

RGB element or array

property rgb#

Returns the corresponding RGB element.

Other than the updating parameter definitions, this is the only change needed to implemented an arbitrary colorspace as a subclass of RGB.

class holoviews.element.Raster(data, kdims=None, vdims=None, extents=None, **params)[source]#

Bases: Element2D

Raster is a basic 2D element type for presenting either numpy or dask arrays as two dimensional raster images.

Arrays with a shape of (N,M) are valid inputs for Raster whereas subclasses of Raster (e.g. RGB) may also accept 3D arrays containing channel information.

Raster does not support slicing like the Image or RGB subclasses and the extents are in matrix coordinates if not explicitly specified.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Raster', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(2, 2), constant=True, default=[Dimension('x'), Dimension('y')], label='Kdims')

The label of the x- and y-dimension of the Raster in form of a string or dimension object.

vdims = List(bounds=(1, None), default=[Dimension('z')], label='Vdims')

The dimension description of the data held in the matrix.

dimension_values(dim, expanded=True, flat=True)[source]#

The set of samples available along a particular dimension.

range(dim, data_range=True, dimension_range=True)[source]#

Return the lower and upper bounds of values along dimension.

Parameters#

dimension

The dimension to compute the range on.

data_rangebool

Compute range from data values

dimension_rangebool

Include Dimension ranges Whether to include Dimension range and soft_range in range calculation

Returns#

Tuple containing the lower and upper bound

reduce(dimensions=None, function=None, **reduce_map)[source]#

Reduces the Raster using functions provided via the kwargs, where the keyword is the dimension to be reduced. Optionally a label_prefix can be provided to prepend to the result Element label.

sample(samples=None, bounds=None, **sample_values)[source]#

Sample the Raster along one or both of its dimensions, returning a reduced dimensionality type, which is either a ItemTable, Curve or Scatter. If two dimension samples and a new_xaxis is provided the sample will be the value of the sampled unit indexed by the value in the new_xaxis tuple.

class holoviews.element.Rectangles(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: SelectionGeomExpr, Geometry

Rectangles represent a collection of axis-aligned rectangles in 2D space.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Rectangles', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(4, 4), constant=True, default=[Dimension('x0'), Dimension('y0'), Dimension('x1'), Dimension('y1')], label='Kdims')

The key dimensions of the Rectangles element represent the bottom-left (x0, y0) and top right (x1, y1) coordinates of each box.

class holoviews.element.Sankey(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Graph

Sankey is an acyclic, directed Graph type that represents the flow of some quantity between its nodes.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Sankey', label='Group')

A string describing the data wrapped by the object.

vdims = List(bounds=(0, None), default=[Dimension('Value')], label='Vdims')

The value dimensions defined as the list of dimensions used to describe the components of the data. If multiple value dimensions are supplied, a particular value dimension may be indexed by name after the key dimensions. Aliased with value_dimensions.

clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)[source]#

Clones the object, overriding data and parameters.

Parameters#

data

New data replacing the existing data

shared_databool, optional

Whether to use existing data

new_typeoptional

Type to cast object to

linkbool, optional

Whether clone should be linked Determines whether Streams and Links attached to original object will be inherited.

*args

Additional arguments to pass to constructor

**overrides

New keyword arguments to pass to constructor

Returns#

Cloned object

class holoviews.element.Scatter(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Selection1DExpr, Chart

Scatter is a Chart element representing a set of points in a 1D coordinate system where the key dimension maps to the points location along the x-axis while the first value dimension represents the location of the point along the y-axis.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Scatter', label='Group')

A string describing the data wrapped by the object.

class holoviews.element.Scatter3D(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Element3D, Points

Scatter3D is a 3D element representing the position of a collection of coordinates in a 3D space. The key dimensions represent the position of each coordinate along the x-, y- and z-axis.

Scatter3D is not available for the default Bokeh backend.

Example - Matplotlib#

import holoviews as hv
from bokeh.sampledata.iris import flowers

hv.extension("matplotlib")

hv.Scatter3D(
    flowers, kdims=["sepal_length", "sepal_width", "petal_length"]
).opts(
    color="petal_width",
    alpha=0.7,
    size=5,
    cmap="fire",
    marker='^'
)

Example - Plotly#

import holoviews as hv
from bokeh.sampledata.iris import flowers

hv.extension("plotly")

hv.Scatter3D(
    flowers, kdims=["sepal_length", "sepal_width", "petal_length"]
).opts(
    color="petal_width",
    alpha=0.7,
    size=5,
    cmap="Portland",
    colorbar=True,
    marker="circle",
)

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Scatter3D', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(3, 3), default=[Dimension('x'), Dimension('y'), Dimension('z')], label='Kdims')

The key dimensions of a geometry represent the x- and y- coordinates in a 2D space.

vdims = List(bounds=(0, None), default=[], label='Vdims')

Scatter3D can have optional value dimensions, which may be mapped onto color and size.

class holoviews.element.Segments(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: SelectionGeomExpr, Geometry

Segments represent a collection of lines in 2D space.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Segments', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(4, 4), constant=True, default=[Dimension('x0'), Dimension('y0'), Dimension('x1'), Dimension('y1')], label='Kdims')

Segments represent lines given by x- and y- coordinates in 2D space.

class holoviews.element.Slope(slope, y_intercept, kdims=None, vdims=None, **params)[source]#

Bases: Annotation

A line drawn with arbitrary slope and y-intercept

Parameter Definitions


Parameters inherited from:

slope = Number(default=0, inclusive_bounds=(True, True), label='Slope')

y_intercept = Number(default=0, inclusive_bounds=(True, True), label='Y intercept')

classmethod from_scatter(element, **kwargs)[source]#

Returns a Slope element given an element of x/y-coordinates

Computes the slope and y-intercept from an element containing x- and y-coordinates.

Parameters#

element

Element to compute slope from

kwargs

Keyword arguments to pass to the Slope element

Returns#

Slope element

class holoviews.element.Spikes(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Selection1DExpr, Chart

Spikes is a Chart element which represents a number of discrete spikes, events or observations in a 1D coordinate system. The key dimension therefore represents the position of each spike along the x-axis while the first value dimension, if defined, controls the height along the y-axis. It may therefore be used to visualize the distribution of discrete events, representing a rug plot, or to draw the strength some signal.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Spikes', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(1, 1), default=[Dimension('x')], label='Kdims')

The key dimension(s) of a Chart represent the independent variable(s).

vdims = List(bounds=(0, None), default=[], label='Vdims')

The value dimensions of the Chart, usually corresponding to a number of dependent variables.

class holoviews.element.Spline(spline_points, **params)[source]#

Bases: Annotation

Draw a spline using the given handle coordinates and handle codes. The constructor accepts a tuple in format (coords, codes).

Follows format of matplotlib spline definitions as used in matplotlib.path.Path with the following codes:

Path.STOP : 0 Path.MOVETO : 1 Path.LINETO : 2 Path.CURVE3 : 3 Path.CURVE4 : 4 Path.CLOSEPLOY: 79

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Spline', label='Group')

A string describing the data wrapped by the object.

clone(data=None, shared_data=True, new_type=None, *args, **overrides)[source]#

Clones the object, overriding data and parameters.

Parameters#

data

New data replacing the existing data

shared_databool, optional

Whether to use existing data

new_typeoptional

Type to cast object to

*args: Additional arguments to pass to constructor **overrides: New keyword arguments to pass to constructor

Returns#

Cloned Spline

dimension_values(dimension, expanded=True, flat=True)[source]#

Return the values along the requested dimension.

Parameters#

dimension : The dimension to return values for expanded : bool, optional

Whether to expand values

flatbool, optional

Whether to flatten array

Returns#

NumPy array of values along the requested dimension

class holoviews.element.Spread(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: ErrorBars

Spread is a Chart element representing a spread of values or confidence band in a 1D coordinate system. The key dimension(s) corresponds to the location along the x-axis and the value dimensions define the location along the y-axis as well as the symmetric or asymmetric spread.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Spread', label='Group')

A string describing the quantity measured by the ErrorBars object.

class holoviews.element.Surface(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Image, Element3D

A Surface represents a regularly sampled 2D grid with associated values defining the height along the z-axis. The key dimensions of a Surface represent the 2D coordinates along the x- and y-axes while the value dimension declares the height at each grid location.

The data of a Surface is usually defined as a 2D array of values and either a bounds tuple defining the extent in the 2D space or explicit x- and y-coordinate arrays.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Surface', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(2, 2), default=[Dimension('x'), Dimension('y')], label='Kdims')

The Surface x and y dimensions of the space defined by the supplied extent.

vdims = List(bounds=(1, 1), default=[Dimension('z')], label='Vdims')

The Surface height dimension.

extents = Tuple(default=(None, None, None, None, None, None), label='Extents', length=6)

Allows overriding the extents of the Element in 3D space defined as (xmin, ymin, zmin, xmax, ymax, zmax).

class holoviews.element.Table(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: SelectionIndexExpr, Dataset, Tabular

Table is a Dataset type, which gets displayed in a tabular format and is convertible to most other Element types.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Table', label='Group')

The group is used to describe the Table.

class holoviews.element.Text(x, y, text, fontsize=12, halign='center', valign='center', rotation=0, **params)[source]#

Bases: Annotation

Draw a text annotation at the specified position with custom fontsize, alignment and rotation.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Text', label='Group')

A string describing the data wrapped by the object.

x = ClassSelector(class_=(<class 'numbers.Number'>, <class 'str'>, <class 'numpy.datetime64'>, <class 'datetime.datetime'>, <class 'datetime.date'>, <class 'datetime.time'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'pandas.core.dtypes.dtypes.DatetimeTZDtype'>, <class 'pandas._libs.tslibs.period.Period'>, <class 'cftime._cftime.datetime'>), default=0, label='X')

The x-position of the arrow which make be numeric or a timestamp.

y = ClassSelector(class_=(<class 'numbers.Number'>, <class 'str'>, <class 'numpy.datetime64'>, <class 'datetime.datetime'>, <class 'datetime.date'>, <class 'datetime.time'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'pandas.core.dtypes.dtypes.DatetimeTZDtype'>, <class 'pandas._libs.tslibs.period.Period'>, <class 'cftime._cftime.datetime'>), default=0, label='Y')

The y-position of the arrow which make be numeric or a timestamp.

text = String(default='', label='Text')

The text to be displayed.

fontsize = Number(default=12, inclusive_bounds=(True, True), label='Fontsize')

Font size of the text.

rotation = Number(default=0, inclusive_bounds=(True, True), label='Rotation')

Text rotation angle in degrees.

halign = Selector(default='center', label='Halign', names={}, objects=['left', 'right', 'center'])

The horizontal alignment position of the displayed text. Allowed values are ‘left’, ‘right’ and ‘center’.

valign = Selector(default='center', label='Valign', names={}, objects=['top', 'bottom', 'center'])

The vertical alignment position of the displayed text. Allowed values are ‘center’, ‘top’ and ‘bottom’.

class holoviews.element.Tiles(data=None, kdims=None, vdims=None, **params)[source]#

Bases: Element2D

The Tiles element represents tile sources, specified as URL containing different template variables or xyzservices.TileProvider. These variables correspond to three different formats for specifying the spatial location and zoom level of the requested tiles:

  • Web mapping tiles sources containing {x}, {y}, and {z} variables

  • Bounding box tile sources containing {XMIN}, {XMAX}, {YMIN}, {YMAX} variables

  • Quadkey tile sources containing a {Q} variable

Tiles are defined in a pseudo-Mercator projection (EPSG:3857) defined as eastings and northings. Any data overlaid on a tile source therefore has to be defined in those coordinates or be projected (e.g. using GeoViews).

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Tiles', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(2, 2), constant=True, default=[Dimension('x'), Dimension('y')], label='Kdims')

The key dimensions of a geometry represent the x- and y- coordinates in a 2D space.

dimension_values(dimension, expanded=True, flat=True)[source]#

Return the values along the requested dimension.

Parameters#

dimension

The dimension to return values for

expandedbool, optional

Whether to expand values Whether to return the expanded values, behavior depends on the type of data:

  • Columnar

    If false returns unique values

  • Geometry

    If false returns scalar values per geometry

  • Gridded

    If false returns 1D coordinates

flatbool, optional

Whether to flatten array

Returns#

NumPy array of values along the requested dimension

static easting_northing_to_lon_lat(easting, northing)[source]#

Projects the given easting, northing values into longitude, latitude coordinates.

See docstring for holoviews.util.transform.easting_northing_to_lon_lat for more information

static lon_lat_to_easting_northing(longitude, latitude)[source]#

Projects the given longitude, latitude values into Web Mercator (aka Pseudo-Mercator or EPSG:3857) coordinates.

See docstring for holoviews.util.transform.lon_lat_to_easting_northing for more information

range(dim, data_range=True, dimension_range=True)[source]#

Return the lower and upper bounds of values along dimension.

Parameters#

dimension

The dimension to compute the range on.

data_rangebool

Compute range from data values

dimension_rangebool

Include Dimension ranges Whether to include Dimension range and soft_range in range calculation

Returns#

Tuple containing the lower and upper bound

class holoviews.element.TriMesh(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Graph

A TriMesh represents a mesh of triangles represented as the simplices and nodes. The simplices represent a indices into the nodes array. The mesh therefore follows a datastructure very similar to a graph, with the abstract connectivity between nodes stored on the TriMesh element itself, the node positions stored on a Nodes element and the concrete paths making up each triangle generated when required by accessing the edgepaths.

Unlike a Graph each simplex is represented as the node indices of the three corners of each triangle.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='TriMesh', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(3, 3), default=['node1', 'node2', 'node3'], label='Kdims')

Dimensions declaring the node indices of each triangle.

property edgepaths#

Returns the EdgePaths by generating a triangle for each simplex.

classmethod from_vertices(data)[source]#

Uses Delauney triangulation to compute triangle simplices for each point.

point_type[source]#

alias of Points

select(selection_specs=None, **selection)[source]#

Allows selecting data by the slices, sets and scalar values along a particular dimension. The indices should be supplied as keywords mapping between the selected dimension and value. Additionally selection_specs (taking the form of a list of type.group.label strings, types or functions) may be supplied, which will ensure the selection is only applied if the specs match the selected object.

class holoviews.element.TriSurface(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Element3D, Points

TriSurface represents a set of coordinates in 3D space which define a surface via a triangulation algorithm (usually Delauney triangulation). They key dimensions of a TriSurface define the position of each point along the x-, y- and z-axes, while value dimensions can provide additional information about each point.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='TriSurface', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(3, 3), default=[Dimension('x'), Dimension('y'), Dimension('z')], label='Kdims')

The key dimensions of a TriSurface represent the 3D coordinates of each point.

vdims = List(bounds=(0, None), default=[], label='Vdims')

The value dimensions of a TriSurface can provide additional information about each 3D coordinate.

class holoviews.element.VLine(x, **params)[source]#

Bases: Annotation

Vertical line annotation at the given position.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='VLine', label='Group')

A string describing the data wrapped by the object.

x = ClassSelector(class_=(<class 'numbers.Number'>, <class 'numpy.datetime64'>, <class 'datetime.datetime'>, <class 'datetime.date'>, <class 'datetime.time'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'pandas.core.dtypes.dtypes.DatetimeTZDtype'>, <class 'pandas._libs.tslibs.period.Period'>, <class 'cftime._cftime.datetime'>), default=0, label='X')

The x-position of the VLine which make be numeric or a timestamp.

dimension_values(dimension, expanded=True, flat=True)[source]#

Return the values along the requested dimension.

Parameters#

dimension

The dimension to return values for

expandedbool, optional

Whether to expand values

flatbool, optional

Whether to flatten array

Returns#

NumPy array of values along the requested dimension

class holoviews.element.VLines(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: VectorizedAnnotation

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='VLines', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(1, 1), default=[Dimension('x')], label='Kdims')

The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.

class holoviews.element.VSpan(x1=None, x2=None, **params)[source]#

Bases: Annotation

Vertical span annotation at the given position.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='VSpan', label='Group')

A string describing the data wrapped by the object.

x1 = ClassSelector(allow_None=True, class_=(<class 'numbers.Number'>, <class 'numpy.datetime64'>, <class 'datetime.datetime'>, <class 'datetime.date'>, <class 'datetime.time'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'pandas.core.dtypes.dtypes.DatetimeTZDtype'>, <class 'pandas._libs.tslibs.period.Period'>, <class 'cftime._cftime.datetime'>), default=0, label='X1')

The start x-position of the VSpan which must be numeric or a timestamp.

x2 = ClassSelector(allow_None=True, class_=(<class 'numbers.Number'>, <class 'numpy.datetime64'>, <class 'datetime.datetime'>, <class 'datetime.date'>, <class 'datetime.time'>, <class 'pandas._libs.tslibs.timestamps.Timestamp'>, <class 'pandas.core.dtypes.dtypes.DatetimeTZDtype'>, <class 'pandas._libs.tslibs.period.Period'>, <class 'cftime._cftime.datetime'>), default=0, label='X2')

The end x-position of the VSpan which must be numeric or a timestamp.

dimension_values(dimension, expanded=True, flat=True)[source]#

Return the values along the requested dimension.

Parameters#

dimension

The dimension to return values for

expandedbool, optional

Whether to expand values

flatbool, optional

Whether to flatten array

Returns#

NumPy array of values along the requested dimension

class holoviews.element.VSpans(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: VectorizedAnnotation

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='VSpans', label='Group')

A string describing the data wrapped by the object.

kdims = List(bounds=(2, 2), default=[Dimension('x0'), Dimension('x1')], label='Kdims')

The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.

class holoviews.element.VectorField(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Selection2DExpr, Geometry

A VectorField represents a set of vectors in 2D space with an associated angle, as well as an optional magnitude and any number of other value dimensions. The angles are assumed to be defined in radians and by default the magnitude is assumed to be normalized to be between 0 and 1.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='VectorField', label='Group')

A string describing the data wrapped by the object.

vdims = List(bounds=(1, None), default=[Dimension('Angle'), Dimension('Magnitude')], label='Vdims')

Value dimensions can be associated with a geometry.

class holoviews.element.VectorizedAnnotation(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: Dataset, Element2D

Parameter Definitions


Parameters inherited from:

class holoviews.element.Violin(data=None, kdims=None, vdims=None, **kwargs)[source]#

Bases: BoxWhisker

Violin elements represent data as 1D distributions visualized as a kernel-density estimate. It may have a single value dimension and any number of key dimensions declaring the grouping of each violin.

Parameter Definitions


Parameters inherited from:

group = String(constant=True, default='Violin', label='Group')

A string describing the data wrapped by the object.