holoviews.element Package#
element
Package#
 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.01.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.
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, vdimsholoviews.core.element.Element2D
: extentsgroup
= param.String(allow_refs=False, constant=True, default=’Annotation’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d833c040>)A string describing the data wrapped by the object.
kdims
= param.List(allow_refs=False, bounds=(2, 2), default=[Dimension(‘x’), Dimension(‘y’)], label=’Kdims’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d833c4c0>)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 multidimensional indexing operation. Aliased with key_dimensions.
 array(dimensions=None)[source]#
Convert dimension values to columnar array.
 Args:
dimensions: List of dimensions to return
 Returns:
Array of columns corresponding to each dimension
 clone(*args, **overrides)[source]#
Clones the object, overriding data and parameters.
 Args:
data: New data replacing the existing data shared_data (bool, optional): Whether to use existing data new_type (optional): Type to cast object to link (bool, 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, **kwargs)[source]#
Snap list or dict of coordinates to closest position.
 Args:
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
 property ddims#
The list of deep dimensions
 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.
 Args:
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.
 Args:
dimension: The dimension to return values for expanded (bool, optional): Whether to expand values flat (bool, optional): Whether to flatten array
 Returns:
NumPy array of values along the requested dimension
 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.
 Args:
 selection: Type of dimensions to return
The type of dimension, i.e. one of ‘key’, ‘value’, ‘constant’ or ‘all’.
 label: Whether 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
 get_dimension(dimension, default=None, strict=False)[source]#
Get a Dimension object by name or index.
 Args:
dimension: Dimension to look up by name or integer index default (optional): Value returned if Dimension not found strict (bool, optional): Raise a KeyError if not found
 Returns:
Dimension object for the requested dimension or default
 get_dimension_index(dimension)[source]#
Get the index of the requested dimension.
 Args:
dimension: Dimension to look up by name or by index
 Returns:
Integer index of 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.
 Args:
dimension: Dimension to look up by name or by index
 Returns:
Declared type of values along the 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.
 Args:
dimension: Dimension(s) to compute histogram on num_bins (int, optional): Number of bins bin_range (tuple optional): Lower and upper bounds of bins adjoin (bool, optional): Whether to adjoin histogram
 Returns:
AdjointLayout of element and histogram or just the histogram
 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)
 Args:
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
 matches(spec)[source]#
Whether the spec applies to this object.
 Args:
 spec: A function, spec or type to check for a match
A ‘type[[.group].label]’ string which is compared against the type, group and label of this object
A function which is given the object and returns a boolean.
An object type matched using isinstance.
 Returns:
bool: Whether the spec matched this object.
 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.
 Args:
 *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.
 backend (optional): Backend to apply options to
Defaults to current selected backend
 clone (bool, 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
 range(dimension, data_range=True, dimension_range=True)[source]#
Return the lower and upper bounds of values along dimension.
 Args:
dimension: The dimension to compute the range on. data_range (bool): Compute range from data values dimension_range (bool): 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, **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)
 Args:
 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.
 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.
 Args:
label (str, optional): New label to apply to returned object group (str, optional): New group to apply to returned object depth (int, 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=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)
 Args:
samples: List of ndcoordinates to sample bounds: Bounds of the region to sample
Defined as twotuple for 1D sampling and fourtuple 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_specs=None, **kwargs)[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])
 Args:
 selection_specs: List 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
 traverse(fn=None, specs=None, full_breadth=True)[source]#
Traverses object returning matching items Traverses the set of children of the object, collecting the all objects matching the defined specs. Each object can be processed with the supplied function. Args:
fn (function, optional): Function applied to matched objects specs: List of specs to match
Specs must be types, functions or type[.group][.label] specs to select objects to return, by default applies to all objects.
 full_breadth: Whether to traverse all objects
Whether to traverse the full set of objects on each container or only the first.
 Returns:
list: List of objects that matched
 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 xaxis, 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.
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.core.data.Dataset
: datatypeholoviews.element.chart.Chart
: kdims, vdimsgroup
= param.String(allow_refs=False, constant=True, default=’Area’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d8484ee0>)A string describing the data wrapped by the object.
 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.
 Args:
dimension: Dimension or dimension spec to add dim_pos (int): Integer index to insert dimension at dim_val (scalar 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.
 Args:
 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
 array(dimensions=None)[source]#
Convert dimension values to columnar array.
 Args:
dimensions: List of dimensions to return
 Returns:
Array of columns corresponding to each dimension
 clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)[source]#
Clones the object, overriding data and parameters.
 Args:
data: New data replacing the existing data shared_data (bool, optional): Whether to use existing data new_type (optional): Type to cast object to link (bool, 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
 Args:
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.
 Args:
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 inmemory format
 property dataset#
The Dataset that this object was created from
 property ddims#
The list of deep dimensions
 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.
 Args:
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.
 Args:
dimension: The dimension to return values for expanded (bool, 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
flat (bool, optional): Whether to flatten array
 Returns:
NumPy array of values along the requested dimension
 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.
 Args:
 selection: Type of dimensions to return
The type of dimension, i.e. one of ‘key’, ‘value’, ‘constant’ or ‘all’.
 label: Whether 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
 get_dimension(dimension, default=None, strict=False)[source]#
Get a Dimension object by name or index.
 Args:
dimension: Dimension to look up by name or integer index default (optional): Value returned if Dimension not found strict (bool, optional): Raise a KeyError if not found
 Returns:
Dimension object for the requested dimension or default
 get_dimension_index(dimension)[source]#
Get the index of the requested dimension.
 Args:
dimension: Dimension to look up by name or by index
 Returns:
Integer index of 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.
 Args:
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 dictionarylike) containing the groups.
 Args:
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.
 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.
 Args:
dimension: Dimension(s) to compute histogram on num_bins (int, optional): Number of bins bin_range (tuple optional): Lower and upper bounds of bins adjoin (bool, optional): Whether to adjoin histogram
 Returns:
AdjointLayout of element and histogram or just the histogram
 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)
 Args:
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
 matches(spec)[source]#
Whether the spec applies to this object.
 Args:
 spec: A function, spec or type to check for a match
A ‘type[[.group].label]’ string which is compared against the type, group and label of this object
A function which is given the object and returns a boolean.
An object type matched using isinstance.
 Returns:
bool: Whether the spec matched this object.
 property ndloc#
Returns ndloc indexer with support for gridded indexing.
Returns an ndloc object providing ndarray like indexing for gridded datasets. Follows NumPy array indexing conventions, allowing for indexing, slicing and selecting a list of indices on multidimensional 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]
, whereiy
andix
are integer indices along the y and x dimensions.Examples:
Index value in 2D array:
dataset.ndloc[3, 1]
Slice along yaxis of 2D array:
dataset.ndloc[2:5, :]
Vectorized (nonorthogonal) indexing along x and yaxes:
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.
 Args:
 *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.
 backend (optional): Backend to apply options to
Defaults to current selected backend
 clone (bool, 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 noop. 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.
 Args:
dimension: The dimension to compute the range on. data_range (bool): Compute range from data values dimension_range (bool): 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)
 Args:
 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 nonvarying key dimensions.x
 Args:
kdims (optional): New list of key dimensionsx vdims (optional): 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.
 Args:
label (str, optional): New label to apply to returned object group (str, optional): New group to apply to returned object depth (int, 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)
 Args:
samples: List of ndcoordinates to sample bounds: Bounds of the region to sample
Defined as twotuple for 1D sampling and fourtuple 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)
 Args:
 selection_expr: holoviews.dim predicate expression
specifying selection.
 selection_specs: List 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.
 Args:
by: Dimension(s) to sort by reverse (bool, optional): Reverse sort order
 Returns:
Sorted Dataset
 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.
 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.
 Args:
 args: Specify the output arguments and transforms as a
tuple of dimension specs and dim transforms
drop (bool): Whether to drop all variables not part of the transform keep_index (bool): 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
 traverse(fn=None, specs=None, full_breadth=True)[source]#
Traverses object returning matching items Traverses the set of children of the object, collecting the all objects matching the defined specs. Each object can be processed with the supplied function. Args:
fn (function, optional): Function applied to matched objects specs: List of specs to match
Specs must be types, functions or type[.group][.label] specs to select objects to return, by default applies to all objects.
 full_breadth: Whether to traverse all objects
Whether to traverse the full set of objects on each container or only the first.
 Returns:
list: List of objects that matched
 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.
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, vdimsholoviews.core.element.Element2D
: extentsgroup
= param.String(allow_refs=False, constant=True, default=’Arrow’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d830bc10>)A string describing the data wrapped by the object.
x
= param.ClassSelector(allow_refs=False, 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’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d8506fb0>)The xposition of the arrow which make be numeric or a timestamp.
y
= param.ClassSelector(allow_refs=False, 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’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d83099c0>)The yposition of the arrow which make be numeric or a timestamp.
text
= param.String(allow_refs=False, default=’’, label=’Text’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d8506fb0>)Text associated with the arrow.
direction
= param.ObjectSelector(allow_refs=False, default=’<’, label=’Direction’, names={}, nested_refs=False, objects=[‘<’, ‘^’, ‘>’, ‘v’], rx=<param.reactive.reactive_ops object at 0x7f52d8309000>)The cardinal direction in which the arrow is pointing. Accepted arrow directions are ‘<’, ‘^’, ‘>’ and ‘v’.
arrowstyle
= param.ObjectSelector(allow_refs=False, default=’>’, label=’Arrowstyle’, names={}, nested_refs=False, objects=[‘’, ‘>’, ‘[’, ‘>', '<>', '<>’], rx=<param.reactive.reactive_ops object at 0x7f52d8505330>)The arrowstyle used to draw the arrow. Accepted arrow styles are ‘’, ‘>’, ‘[’, ‘>', '<>' and '<>’
points
= param.Number(allow_refs=False, default=40, inclusive_bounds=(True, True), label=’Points’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d8309000>)Font size of arrow text (if any).
 array(dimensions=None)[source]#
Convert dimension values to columnar array.
 Args:
dimensions: List of dimensions to return
 Returns:
Array of columns corresponding to each dimension
 clone(*args, **overrides)[source]#
Clones the object, overriding data and parameters.
 Args:
data: New data replacing the existing data shared_data (bool, optional): Whether to use existing data new_type (optional): Type to cast object to link (bool, 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, **kwargs)[source]#
Snap list or dict of coordinates to closest position.
 Args:
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
 property ddims#
The list of deep dimensions
 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.
 Args:
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.
 Args:
dimension: The dimension to return values for expanded (bool, optional): Whether to expand values flat (bool, optional): Whether to flatten array
 Returns:
NumPy array of values along the requested dimension
 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.
 Args:
 selection: Type of dimensions to return
The type of dimension, i.e. one of ‘key’, ‘value’, ‘constant’ or ‘all’.
 label: Whether 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
 get_dimension(dimension, default=None, strict=False)[source]#
Get a Dimension object by name or index.
 Args:
dimension: Dimension to look up by name or integer index default (optional): Value returned if Dimension not found strict (bool, optional): Raise a KeyError if not found
 Returns:
Dimension object for the requested dimension or default
 get_dimension_index(dimension)[source]#
Get the index of the requested dimension.
 Args:
dimension: Dimension to look up by name or by index
 Returns:
Integer index of 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.
 Args:
dimension: Dimension to look up by name or by index
 Returns:
Declared type of values along the 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.
 Args:
dimension: Dimension(s) to compute histogram on num_bins (int, optional): Number of bins bin_range (tuple optional): Lower and upper bounds of bins adjoin (bool, optional): Whether to adjoin histogram
 Returns:
AdjointLayout of element and histogram or just the histogram
 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)
 Args:
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
 matches(spec)[source]#
Whether the spec applies to this object.
 Args:
 spec: A function, spec or type to check for a match
A ‘type[[.group].label]’ string which is compared against the type, group and label of this object
A function which is given the object and returns a boolean.
An object type matched using isinstance.
 Returns:
bool: Whether the spec matched this object.
 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.
 Args:
 *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.
 backend (optional): Backend to apply options to
Defaults to current selected backend
 clone (bool, 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
 range(dimension, data_range=True, dimension_range=True)[source]#
Return the lower and upper bounds of values along dimension.
 Args:
dimension: The dimension to compute the range on. data_range (bool): Compute range from data values dimension_range (bool): 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, **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)
 Args:
 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.
 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.
 Args:
label (str, optional): New label to apply to returned object group (str, optional): New group to apply to returned object depth (int, 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=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)
 Args:
samples: List of ndcoordinates to sample bounds: Bounds of the region to sample
Defined as twotuple for 1D sampling and fourtuple 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_specs=None, **kwargs)[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])
 Args:
 selection_specs: List 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
 traverse(fn=None, specs=None, full_breadth=True)[source]#
Traverses object returning matching items Traverses the set of children of the object, collecting the all objects matching the defined specs. Each object can be processed with the supplied function. Args:
fn (function, optional): Function applied to matched objects specs: List of specs to match
Specs must be types, functions or type[.group][.label] specs to select objects to return, by default applies to all objects.
 full_breadth: Whether to traverse all objects
Whether to traverse the full set of objects on each container or only the first.
 Returns:
list: List of objects that matched
 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.
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.core.data.Dataset
: datatypegroup
= param.String(allow_refs=False, constant=True, default=’Bars’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d833cd60>)A string describing the data wrapped by the object.
kdims
= param.List(allow_refs=False, bounds=(1, 3), default=[Dimension(‘x’)], label=’Kdims’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d8506710>)The key dimension(s) of a Chart represent the independent variable(s).
 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.
 Args:
dimension: Dimension or dimension spec to add dim_pos (int): Integer index to insert dimension at dim_val (scalar 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.
 Args:
 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
 array(dimensions=None)[source]#
Convert dimension values to columnar array.
 Args:
dimensions: List of dimensions to return
 Returns:
Array of columns corresponding to each dimension
 clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)[source]#
Clones the object, overriding data and parameters.
 Args:
data: New data replacing the existing data shared_data (bool, optional): Whether to use existing data new_type (optional): Type to cast object to link (bool, 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
 Args:
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.
 Args:
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 inmemory format
 property dataset#
The Dataset that this object was created from
 property ddims#
The list of deep dimensions
 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.
 Args:
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.
 Args:
dimension: The dimension to return values for expanded (bool, 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
flat (bool, optional): Whether to flatten array
 Returns:
NumPy array of values along the requested dimension
 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.
 Args:
 selection: Type of dimensions to return
The type of dimension, i.e. one of ‘key’, ‘value’, ‘constant’ or ‘all’.
 label: Whether 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
 get_dimension(dimension, default=None, strict=False)[source]#
Get a Dimension object by name or index.
 Args:
dimension: Dimension to look up by name or integer index default (optional): Value returned if Dimension not found strict (bool, optional): Raise a KeyError if not found
 Returns:
Dimension object for the requested dimension or default
 get_dimension_index(dimension)[source]#
Get the index of the requested dimension.
 Args:
dimension: Dimension to look up by name or by index
 Returns:
Integer index of 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.
 Args:
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 dictionarylike) containing the groups.
 Args:
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.
 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.
 Args:
dimension: Dimension(s) to compute histogram on num_bins (int, optional): Number of bins bin_range (tuple optional): Lower and upper bounds of bins adjoin (bool, optional): Whether to adjoin histogram
 Returns:
AdjointLayout of element and histogram or just the histogram
 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)
 Args:
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
 matches(spec)[source]#
Whether the spec applies to this object.
 Args:
 spec: A function, spec or type to check for a match
A ‘type[[.group].label]’ string which is compared against the type, group and label of this object
A function which is given the object and returns a boolean.
An object type matched using isinstance.
 Returns:
bool: Whether the spec matched this object.
 property ndloc#
Returns ndloc indexer with support for gridded indexing.
Returns an ndloc object providing ndarray like indexing for gridded datasets. Follows NumPy array indexing conventions, allowing for indexing, slicing and selecting a list of indices on multidimensional 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]
, whereiy
andix
are integer indices along the y and x dimensions.Examples:
Index value in 2D array:
dataset.ndloc[3, 1]
Slice along yaxis of 2D array:
dataset.ndloc[2:5, :]
Vectorized (nonorthogonal) indexing along x and yaxes:
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.
 Args:
 *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.
 backend (optional): Backend to apply options to
Defaults to current selected backend
 clone (bool, 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 noop. 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.
 Args:
dimension: The dimension to compute the range on. data_range (bool): Compute range from data values dimension_range (bool): 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)
 Args:
 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 nonvarying key dimensions.x
 Args:
kdims (optional): New list of key dimensionsx vdims (optional): 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.
 Args:
label (str, optional): New label to apply to returned object group (str, optional): New group to apply to returned object depth (int, 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)
 Args:
samples: List of ndcoordinates to sample bounds: Bounds of the region to sample
Defined as twotuple for 1D sampling and fourtuple 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)
 Args:
 selection_expr: holoviews.dim predicate expression
specifying selection.
 selection_specs: List 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.
 Args:
by: Dimension(s) to sort by reverse (bool, 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.
 Args:
 args: Specify the output arguments and transforms as a
tuple of dimension specs and dim transforms
drop (bool): Whether to drop all variables not part of the transform keep_index (bool): 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
 traverse(fn=None, specs=None, full_breadth=True)[source]#
Traverses object returning matching items Traverses the set of children of the object, collecting the all objects matching the defined specs. Each object can be processed with the supplied function. Args:
fn (function, optional): Function applied to matched objects specs: List of specs to match
Specs must be types, functions or type[.group][.label] specs to select objects to return, by default applies to all objects.
 full_breadth: Whether to traverse all objects
Whether to traverse the full set of objects on each container or only the first.
 Returns:
list: List of objects that matched
 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 ycolumns.
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.core.data.Dataset
: datatypegroup
= param.String(allow_refs=False, constant=True, default=’Bivariate’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3b73a30>)A string describing the data wrapped by the object.
kdims
= param.List(allow_refs=False, bounds=(2, 2), default=[Dimension(‘x’), Dimension(‘y’)], label=’Kdims’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3b72bf0>)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 multidimensional indexing operation. Aliased with key_dimensions.
vdims
= param.List(allow_refs=False, bounds=(0, 1), default=[Dimension(‘Density’)], label=’Vdims’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3b71b40>)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.
 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.
 Args:
dimension: Dimension or dimension spec to add dim_pos (int): Integer index to insert dimension at dim_val (scalar 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.
 Args:
 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
 array(dimensions=None)[source]#
Convert dimension values to columnar array.
 Args:
dimensions: List of dimensions to return
 Returns:
Array of columns corresponding to each dimension
 clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)[source]#
Clones the object, overriding data and parameters.
 Args:
data: New data replacing the existing data shared_data (bool, optional): Whether to use existing data new_type (optional): Type to cast object to link (bool, 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
 Args:
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.
 Args:
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 inmemory format
 property dataset#
The Dataset that this object was created from
 property ddims#
The list of deep dimensions
 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.
 Args:
dimensions: Dimensions to return as columns multi_index: Convert key dimensions to (multi)index
 Returns:
DataFrame of columns corresponding to each dimension
 dimension_values(dim, expanded=True, flat=True)[source]#
Return the values along the requested dimension.
 Args:
dimension: The dimension to return values for expanded (bool, 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
flat (bool, optional): Whether to flatten array
 Returns:
NumPy array of values along the requested dimension
 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.
 Args:
 selection: Type of dimensions to return
The type of dimension, i.e. one of ‘key’, ‘value’, ‘constant’ or ‘all’.
 label: Whether 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
 get_dimension(dimension, default=None, strict=False)[source]#
Get a Dimension object by name or index.
 Args:
dimension: Dimension to look up by name or integer index default (optional): Value returned if Dimension not found strict (bool, optional): Raise a KeyError if not found
 Returns:
Dimension object for the requested dimension or default
 get_dimension_index(dimension)[source]#
Get the index of the requested dimension.
 Args:
dimension: Dimension to look up by name or by index
 Returns:
Integer index of 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.
 Args:
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 dictionarylike) containing the groups.
 Args:
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.
 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.
 Args:
dimension: Dimension(s) to compute histogram on num_bins (int, optional): Number of bins bin_range (tuple optional): Lower and upper bounds of bins adjoin (bool, optional): Whether to adjoin histogram
 Returns:
AdjointLayout of element and histogram or just the histogram
 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)
 Args:
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
 matches(spec)[source]#
Whether the spec applies to this object.
 Args:
 spec: A function, spec or type to check for a match
A ‘type[[.group].label]’ string which is compared against the type, group and label of this object
A function which is given the object and returns a boolean.
An object type matched using isinstance.
 Returns:
bool: Whether the spec matched this object.
 property ndloc#
Returns ndloc indexer with support for gridded indexing.
Returns an ndloc object providing ndarray like indexing for gridded datasets. Follows NumPy array indexing conventions, allowing for indexing, slicing and selecting a list of indices on multidimensional 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]
, whereiy
andix
are integer indices along the y and x dimensions.Examples:
Index value in 2D array:
dataset.ndloc[3, 1]
Slice along yaxis of 2D array:
dataset.ndloc[2:5, :]
Vectorized (nonorthogonal) indexing along x and yaxes:
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.
 Args:
 *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.
 backend (optional): Backend to apply options to
Defaults to current selected backend
 clone (bool, 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 noop. 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.
 Args:
dimension: The dimension to compute the range on. data_range (bool): Compute range from data values dimension_range (bool): 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)
 Args:
 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 nonvarying key dimensions.x
 Args:
kdims (optional): New list of key dimensionsx vdims (optional): 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.
 Args:
label (str, optional): New label to apply to returned object group (str, optional): New group to apply to returned object depth (int, 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)
 Args:
samples: List of ndcoordinates to sample bounds: Bounds of the region to sample
Defined as twotuple for 1D sampling and fourtuple 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)
 Args:
 selection_expr: holoviews.dim predicate expression
specifying selection.
 selection_specs: List 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.
 Args:
by: Dimension(s) to sort by reverse (bool, 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.
 Args:
 args: Specify the output arguments and transforms as a
tuple of dimension specs and dim transforms
drop (bool): Whether to drop all variables not part of the transform keep_index (bool): 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
 traverse(fn=None, specs=None, full_breadth=True)[source]#
Traverses object returning matching items Traverses the set of children of the object, collecting the all objects matching the defined specs. Each object can be processed with the supplied function. Args:
fn (function, optional): Function applied to matched objects specs: List of specs to match
Specs must be types, functions or type[.group][.label] specs to select objects to return, by default applies to all objects.
 full_breadth: Whether to traverse all objects
Whether to traverse the full set of objects on each container or only the first.
 Returns:
list: List of objects that matched
 class holoviews.element.Bounds(*args, **kwargs)[source]#
Bases:
BaseShape
An arbitrary axisaligned 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, zerocenter box which will be used to compute the corresponding lbrt tuple.
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.element.geom.Geometry
: kdims, vdimsholoviews.element.path.Path
: datatypegroup
= param.String(allow_refs=False, constant=True, default=’Bounds’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3b737c0>)The assigned group name.
lbrt
= param.Tuple(allow_refs=False, default=(0.5, 0.5, 0.5, 0.5), label=’Lbrt’, length=4, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3bc1c00>)The (left, bottom, right, top) coordinates of the bounding box.
 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.
 Args:
dimension: Dimension or dimension spec to add dim_pos (int): Integer index to insert dimension at dim_val (scalar 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.
 Args:
 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
 array(dimensions=None)[source]#
Convert dimension values to columnar array.
 Args:
dimensions: List of dimensions to return
 Returns:
Array of columns corresponding to each dimension
 clone(*args, **overrides)[source]#
Returns a clone of the object with matching parameter values containing the specified args and kwargs.
 closest(coords=None, **kwargs)[source]#
Snaps coordinate(s) to closest coordinate in Dataset
 Args:
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.
 Args:
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 inmemory format
 property dataset#
The Dataset that this object was created from
 property ddims#
The list of deep dimensions
 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.
 Args:
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.
 Args:
dimension: The dimension to return values for expanded (bool, 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
flat (bool, optional): Whether to flatten array
 Returns:
NumPy array of values along the requested dimension
 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.
 Args:
 selection: Type of dimensions to return
The type of dimension, i.e. one of ‘key’, ‘value’, ‘constant’ or ‘all’.
 label: Whether 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
 get_dimension(dimension, default=None, strict=False)[source]#
Get a Dimension object by name or index.
 Args:
dimension: Dimension to look up by name or integer index default (optional): Value returned if Dimension not found strict (bool, optional): Raise a KeyError if not found
 Returns:
Dimension object for the requested dimension or default
 get_dimension_index(dimension)[source]#
Get the index of the requested dimension.
 Args:
dimension: Dimension to look up by name or by index
 Returns:
Integer index of 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.
 Args:
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 dictionarylike) containing the groups.
 Args:
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.
 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.
 Args:
dimension: Dimension(s) to compute histogram on num_bins (int, optional): Number of bins bin_range (tuple optional): Lower and upper bounds of bins adjoin (bool, optional): Whether to adjoin histogram
 Returns:
AdjointLayout of element and histogram or just the histogram
 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)
 Args:
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
 matches(spec)[source]#
Whether the spec applies to this object.
 Args:
 spec: A function, spec or type to check for a match
A ‘type[[.group].label]’ string which is compared against the type, group and label of this object
A function which is given the object and returns a boolean.
An object type matched using isinstance.
 Returns:
bool: Whether the spec matched this object.
 property ndloc#
Returns ndloc indexer with support for gridded indexing.
Returns an ndloc object providing ndarray like indexing for gridded datasets. Follows NumPy array indexing conventions, allowing for indexing, slicing and selecting a list of indices on multidimensional 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]
, whereiy
andix
are integer indices along the y and x dimensions.Examples:
Index value in 2D array:
dataset.ndloc[3, 1]
Slice along yaxis of 2D array:
dataset.ndloc[2:5, :]
Vectorized (nonorthogonal) indexing along x and yaxes:
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.
 Args:
 *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.
 backend (optional): Backend to apply options to
Defaults to current selected backend
 clone (bool, 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 noop. 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.
 Args:
dimension: The dimension to compute the range on. data_range (bool): Compute range from data values dimension_range (bool): 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)
 Args:
 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 nonvarying key dimensions.x
 Args:
kdims (optional): New list of key dimensionsx vdims (optional): 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.
 Args:
label (str, optional): New label to apply to returned object group (str, optional): New group to apply to returned object depth (int, 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)
 Args:
samples: List of ndcoordinates to sample bounds: Bounds of the region to sample
Defined as twotuple for 1D sampling and fourtuple 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)
 Args:
 selection_expr: holoviews.dim predicate expression
specifying selection.
 selection_specs: List 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.
 Args:
by: Dimension(s) to sort by reverse (bool, optional): Reverse sort order
 Returns:
Sorted Dataset
 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.
 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.
 Args:
 args: Specify the output arguments and transforms as a
tuple of dimension specs and dim transforms
drop (bool): Whether to drop all variables not part of the transform keep_index (bool): 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
 traverse(fn=None, specs=None, full_breadth=True)[source]#
Traverses object returning matching items Traverses the set of children of the object, collecting the all objects matching the defined specs. Each object can be processed with the supplied function. Args:
fn (function, optional): Function applied to matched objects specs: List of specs to match
Specs must be types, functions or type[.group][.label] specs to select objects to return, by default applies to all objects.
 full_breadth: Whether to traverse all objects
Whether to traverse the full set of objects on each container or only the first.
 Returns:
list: List of objects that matched
 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).
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.element.geom.Geometry
: kdims, vdimsholoviews.element.path.Path
: datatypegroup
= param.String(allow_refs=False, constant=True, default=’Box’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3b71600>)The assigned group name.
x
= param.Number(allow_refs=False, default=0, inclusive_bounds=(True, True), label=’X’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3b70ca0>)The xposition of the box center.
y
= param.Number(allow_refs=False, default=0, inclusive_bounds=(True, True), label=’Y’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3b70700>)The yposition of the box center.
width
= param.Number(allow_refs=False, default=1, inclusive_bounds=(True, True), label=’Width’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3b71b10>)The width of the box.
height
= param.Number(allow_refs=False, default=1, inclusive_bounds=(True, True), label=’Height’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3b71ed0>)The height of the box.
orientation
= param.Number(allow_refs=False, default=0, inclusive_bounds=(True, True), label=’Orientation’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3b710f0>)Orientation in the Cartesian coordinate system, the counterclockwise angle in radians between the first axis and the horizontal.
aspect
= param.Number(allow_refs=False, default=1.0, inclusive_bounds=(True, True), label=’Aspect’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3b72020>)Optional multiplier applied to the box size to compute the width in cases where only the length value is set.
 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.
 Args:
dimension: Dimension or dimension spec to add dim_pos (int): Integer index to insert dimension at dim_val (scalar 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.
 Args:
 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
 array(dimensions=None)[source]#
Convert dimension values to columnar array.
 Args:
dimensions: List of dimensions to return
 Returns:
Array of columns corresponding to each dimension
 clone(*args, **overrides)[source]#
Returns a clone of the object with matching parameter values containing the specified args and kwargs.
 closest(coords=None, **kwargs)[source]#
Snaps coordinate(s) to closest coordinate in Dataset
 Args:
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.
 Args:
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 inmemory format
 property dataset#
The Dataset that this object was created from
 property ddims#
The list of deep dimensions
 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.
 Args:
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.
 Args:
dimension: The dimension to return values for expanded (bool, 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
flat (bool, optional): Whether to flatten array
 Returns:
NumPy array of values along the requested dimension
 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.
 Args:
 selection: Type of dimensions to return
The type of dimension, i.e. one of ‘key’, ‘value’, ‘constant’ or ‘all’.
 label: Whether 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
 get_dimension(dimension, default=None, strict=False)[source]#
Get a Dimension object by name or index.
 Args:
dimension: Dimension to look up by name or integer index default (optional): Value returned if Dimension not found strict (bool, optional): Raise a KeyError if not found
 Returns:
Dimension object for the requested dimension or default
 get_dimension_index(dimension)[source]#
Get the index of the requested dimension.
 Args:
dimension: Dimension to look up by name or by index
 Returns:
Integer index of 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.
 Args:
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 dictionarylike) containing the groups.
 Args:
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.
 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.
 Args:
dimension: Dimension(s) to compute histogram on num_bins (int, optional): Number of bins bin_range (tuple optional): Lower and upper bounds of bins adjoin (bool, optional): Whether to adjoin histogram
 Returns:
AdjointLayout of element and histogram or just the histogram
 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)
 Args:
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
 matches(spec)[source]#
Whether the spec applies to this object.
 Args:
 spec: A function, spec or type to check for a match
A ‘type[[.group].label]’ string which is compared against the type, group and label of this object
A function which is given the object and returns a boolean.
An object type matched using isinstance.
 Returns:
bool: Whether the spec matched this object.
 property ndloc#
Returns ndloc indexer with support for gridded indexing.
Returns an ndloc object providing ndarray like indexing for gridded datasets. Follows NumPy array indexing conventions, allowing for indexing, slicing and selecting a list of indices on multidimensional 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]
, whereiy
andix
are integer indices along the y and x dimensions.Examples:
Index value in 2D array:
dataset.ndloc[3, 1]
Slice along yaxis of 2D array:
dataset.ndloc[2:5, :]
Vectorized (nonorthogonal) indexing along x and yaxes:
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.
 Args:
 *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.
 backend (optional): Backend to apply options to
Defaults to current selected backend
 clone (bool, 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 noop. 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.
 Args:
dimension: The dimension to compute the range on. data_range (bool): Compute range from data values dimension_range (bool): 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)
 Args:
 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 nonvarying key dimensions.x
 Args:
kdims (optional): New list of key dimensionsx vdims (optional): 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.
 Args:
label (str, optional): New label to apply to returned object group (str, optional): New group to apply to returned object depth (int, 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)
 Args:
samples: List of ndcoordinates to sample bounds: Bounds of the region to sample
Defined as twotuple for 1D sampling and fourtuple 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)
 Args:
 selection_expr: holoviews.dim predicate expression
specifying selection.
 selection_specs: List 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.
 Args:
by: Dimension(s) to sort by reverse (bool, optional): Reverse sort order
 Returns:
Sorted Dataset
 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.
 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.
 Args:
 args: Specify the output arguments and transforms as a
tuple of dimension specs and dim transforms
drop (bool): Whether to drop all variables not part of the transform keep_index (bool): 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
 traverse(fn=None, specs=None, full_breadth=True)[source]#
Traverses object returning matching items Traverses the set of children of the object, collecting the all objects matching the defined specs. Each object can be processed with the supplied function. Args:
fn (function, optional): Function applied to matched objects specs: List of specs to match
Specs must be types, functions or type[.group][.label] specs to select objects to return, by default applies to all objects.
 full_breadth: Whether to traverse all objects
Whether to traverse the full set of objects on each container or only the first.
 Returns:
list: List of objects that matched
 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.
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.core.data.Dataset
: datatypegroup
= param.String(allow_refs=False, constant=True, default=’BoxWhisker’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3bc0610>)A string describing the data wrapped by the object.
kdims
= param.List(allow_refs=False, bounds=(0, None), default=[], label=’Kdims’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3bc3fa0>)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 multidimensional indexing operation. Aliased with key_dimensions.
vdims
= param.List(allow_refs=False, bounds=(1, 1), default=[Dimension(‘y’)], label=’Vdims’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3bc1210>)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.
 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.
 Args:
dimension: Dimension or dimension spec to add dim_pos (int): Integer index to insert dimension at dim_val (scalar 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.
 Args:
 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
 array(dimensions=None)[source]#
Convert dimension values to columnar array.
 Args:
dimensions: List of dimensions to return
 Returns:
Array of columns corresponding to each dimension
 clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)[source]#
Clones the object, overriding data and parameters.
 Args:
data: New data replacing the existing data shared_data (bool, optional): Whether to use existing data new_type (optional): Type to cast object to link (bool, 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
 Args:
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.
 Args:
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 inmemory format
 property dataset#
The Dataset that this object was created from
 property ddims#
The list of deep dimensions
 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.
 Args:
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.
 Args:
dimension: The dimension to return values for expanded (bool, 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
flat (bool, optional): Whether to flatten array
 Returns:
NumPy array of values along the requested dimension
 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.
 Args:
 selection: Type of dimensions to return
The type of dimension, i.e. one of ‘key’, ‘value’, ‘constant’ or ‘all’.
 label: Whether 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
 get_dimension(dimension, default=None, strict=False)[source]#
Get a Dimension object by name or index.
 Args:
dimension: Dimension to look up by name or integer index default (optional): Value returned if Dimension not found strict (bool, optional): Raise a KeyError if not found
 Returns:
Dimension object for the requested dimension or default
 get_dimension_index(dimension)[source]#
Get the index of the requested dimension.
 Args:
dimension: Dimension to look up by name or by index
 Returns:
Integer index of 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.
 Args:
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 dictionarylike) containing the groups.
 Args:
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.
 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.
 Args:
dimension: Dimension(s) to compute histogram on num_bins (int, optional): Number of bins bin_range (tuple optional): Lower and upper bounds of bins adjoin (bool, optional): Whether to adjoin histogram
 Returns:
AdjointLayout of element and histogram or just the histogram
 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)
 Args:
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
 matches(spec)[source]#
Whether the spec applies to this object.
 Args:
 spec: A function, spec or type to check for a match
A ‘type[[.group].label]’ string which is compared against the type, group and label of this object
A function which is given the object and returns a boolean.
An object type matched using isinstance.
 Returns:
bool: Whether the spec matched this object.
 property ndloc#
Returns ndloc indexer with support for gridded indexing.
Returns an ndloc object providing ndarray like indexing for gridded datasets. Follows NumPy array indexing conventions, allowing for indexing, slicing and selecting a list of indices on multidimensional 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]
, whereiy
andix
are integer indices along the y and x dimensions.Examples:
Index value in 2D array:
dataset.ndloc[3, 1]
Slice along yaxis of 2D array:
dataset.ndloc[2:5, :]
Vectorized (nonorthogonal) indexing along x and yaxes:
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.
 Args:
 *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.
 backend (optional): Backend to apply options to
Defaults to current selected backend
 clone (bool, 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 noop. 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.
 Args:
dimension: The dimension to compute the range on. data_range (bool): Compute range from data values dimension_range (bool): 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)
 Args:
 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 nonvarying key dimensions.x
 Args:
kdims (optional): New list of key dimensionsx vdims (optional): 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.
 Args:
label (str, optional): New label to apply to returned object group (str, optional): New group to apply to returned object depth (int, 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)
 Args:
samples: List of ndcoordinates to sample bounds: Bounds of the region to sample
Defined as twotuple for 1D sampling and fourtuple 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)
 Args:
 selection_expr: holoviews.dim predicate expression
specifying selection.
 selection_specs: List 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.
 Args:
by: Dimension(s) to sort by reverse (bool, 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.
 Args:
 args: Specify the output arguments and transforms as a
tuple of dimension specs and dim transforms
drop (bool): Whether to drop all variables not part of the transform keep_index (bool): 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
 traverse(fn=None, specs=None, full_breadth=True)[source]#
Traverses object returning matching items Traverses the set of children of the object, collecting the all objects matching the defined specs. Each object can be processed with the supplied function. Args:
fn (function, optional): Function applied to matched objects specs: List of specs to match
Specs must be types, functions or type[.group][.label] specs to select objects to return, by default applies to all objects.
 full_breadth: Whether to traverse all objects
Whether to traverse the full set of objects on each container or only the first.
 Returns:
list: List of objects that matched
 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.
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, vdimsholoviews.core.element.Element2D
: extentsholoviews.core.data.Dataset
: datatypegroup
= param.String(allow_refs=False, constant=True, default=’Chord’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3a0f640>)A string describing the data wrapped by the object.
 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.
 Args:
dimension: Dimension or dimension spec to add dim_pos (int): Integer index to insert dimension at dim_val (scalar 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.
 Args:
 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
 array(dimensions=None)[source]#
Convert dimension values to columnar array.
 Args:
dimensions: List of dimensions to return
 Returns:
Array of columns corresponding to each dimension
 clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)[source]#
Clones the object, overriding data and parameters.
 Args:
data: New data replacing the existing data shared_data (bool, optional): Whether to use existing data new_type (optional): Type to cast object to link (bool, 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
 Args:
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.
 Args:
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 inmemory format
 property dataset#
The Dataset that this object was created from
 property ddims#
The list of deep dimensions
 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.
 Args:
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.
 Args:
dimension: The dimension to return values for expanded (bool, 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
flat (bool, optional): Whether to flatten array
 Returns:
NumPy array of values along the requested dimension
 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.
 Args:
 selection: Type of dimensions to return
The type of dimension, i.e. one of ‘key’, ‘value’, ‘constant’ or ‘all’.
 label: Whether 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
 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 nonscalar attributes, such as lists or dictionaries will be ignored.
 Args:
G (networkx.Graph): Graph to convert to Graph element positions (dict 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
kwargs (dict): Keyword arguments for layout function
 Returns:
Graph element
 get_dimension(dimension, default=None, strict=False)[source]#
Get a Dimension object by name or index.
 Args:
dimension: Dimension to look up by name or integer index default (optional): Value returned if Dimension not found strict (bool, optional): Raise a KeyError if not found
 Returns:
Dimension object for the requested dimension or default
 get_dimension_index(dimension)[source]#
Get the index of the requested dimension.
 Args:
dimension: Dimension to look up by name or by index
 Returns:
Integer index of 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.
 Args:
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 dictionarylike) containing the groups.
 Args:
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.
 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.
 Args:
dimension: Dimension(s) to compute histogram on num_bins (int, optional): Number of bins bin_range (tuple optional): Lower and upper bounds of bins adjoin (bool, optional): Whether to adjoin histogram
 Returns:
AdjointLayout of element and histogram or just the histogram
 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)
 Args:
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
 matches(spec)[source]#
Whether the spec applies to this object.
 Args:
 spec: A function, spec or type to check for a match
A ‘type[[.group].label]’ string which is compared against the type, group and label of this object
A function which is given the object and returns a boolean.
An object type matched using isinstance.
 Returns:
bool: Whether the spec matched this object.
 property ndloc#
Returns ndloc indexer with support for gridded indexing.
Returns an ndloc object providing ndarray like indexing for gridded datasets. Follows NumPy array indexing conventions, allowing for indexing, slicing and selecting a list of indices on multidimensional 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]
, whereiy
andix
are integer indices along the y and x dimensions.Examples:
Index value in 2D array:
dataset.ndloc[3, 1]
Slice along yaxis of 2D array:
dataset.ndloc[2:5, :]
Vectorized (nonorthogonal) indexing along x and yaxes:
dataset.ndloc[[1, 2, 3], [0, 2, 3]]
 property nodes#
Computes the node positions the first time they are requested if no explicit node information was supplied.
 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.
 Args:
 *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.
 backend (optional): Backend to apply options to
Defaults to current selected backend
 clone (bool, 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 noop. 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(dimension, data_range=True, dimension_range=True)[source]#
Return the lower and upper bounds of values along dimension.
 Args:
dimension: The dimension to compute the range on. data_range (bool): Compute range from data values dimension_range (bool): 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)
 Args:
 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 nonvarying key dimensions.x
 Args:
kdims (optional): New list of key dimensionsx vdims (optional): 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.
 Args:
label (str, optional): New label to apply to returned object group (str, optional): New group to apply to returned object depth (int, 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)
 Args:
samples: List of ndcoordinates to sample bounds: Bounds of the region to sample
Defined as twotuple for 1D sampling and fourtuple 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_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’.
 property shape#
Returns the shape of the data.
 sort(by=None, reverse=False)[source]#
Sorts the data by the values along the supplied dimensions.
 Args:
by: Dimension(s) to sort by reverse (bool, 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.
 Args:
 args: Specify the output arguments and transforms as a
tuple of dimension specs and dim transforms
drop (bool): Whether to drop all variables not part of the transform keep_index (bool): 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
 traverse(fn=None, specs=None, full_breadth=True)[source]#
Traverses object returning matching items Traverses the set of children of the object, collecting the all objects matching the defined specs. Each object can be processed with the supplied function. Args:
fn (function, optional): Function applied to matched objects specs: List of specs to match
Specs must be types, functions or type[.group][.label] specs to select objects to return, by default applies to all objects.
 full_breadth: Whether to traverse all objects
Whether to traverse the full set of objects on each container or only the first.
 Returns:
list: List of objects that matched
 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 isocontours 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 ycoordinates along with any other (scalar) values:
[{‘x’: 1darray, ‘y’: 1darray, ‘value’: scalar}, …]
Alternatively Contours also supports a single columnar datastructure to specify an individual contour:
{‘x’: 1darray, ‘y’: 1darray, ‘value’: scalar, ‘continuous’: 1darray}
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 isocontour.
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.
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.element.geom.Geometry
: kdimsholoviews.element.path.Path
: datatypegroup
= param.String(allow_refs=False, constant=True, default=’Contours’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3a0de10>)A string describing the data wrapped by the object.
vdims
= param.List(allow_refs=False, bounds=(0, None), constant=True, default=[], label=’Vdims’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3a0e380>)Contours optionally accept a value dimension, corresponding to the supplied values.
 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.
 Args:
dimension: Dimension or dimension spec to add dim_pos (int): Integer index to insert dimension at dim_val (scalar 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.
 Args:
 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
 array(dimensions=None)[source]#
Convert dimension values to columnar array.
 Args:
dimensions: List of dimensions to return
 Returns:
Array of columns corresponding to each dimension
 clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)[source]#
Clones the object, overriding data and parameters.
 Args:
data: New data replacing the existing data shared_data (bool, optional): Whether to use existing data new_type (optional): Type to cast object to link (bool, 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
 Args:
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.
 Args:
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 inmemory format
 property dataset#
The Dataset that this object was created from
 property ddims#
The list of deep dimensions
 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.
 Args:
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.
 Args:
dimension: The dimension to return values for expanded (bool, 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
flat (bool, optional): Whether to flatten array
 Returns:
NumPy array of values along the requested dimension
 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.
 Args:
 selection: Type of dimensions to return
The type of dimension, i.e. one of ‘key’, ‘value’, ‘constant’ or ‘all’.
 label: Whether 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
 get_dimension(dimension, default=None, strict=False)[source]#
Get a Dimension object by name or index.
 Args:
dimension: Dimension to look up by name or integer index default (optional): Value returned if Dimension not found strict (bool, optional): Raise a KeyError if not found
 Returns:
Dimension object for the requested dimension or default
 get_dimension_index(dimension)[source]#
Get the index of the requested dimension.
 Args:
dimension: Dimension to look up by name or by index
 Returns:
Integer index of 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.
 Args:
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 dictionarylike) containing the groups.
 Args:
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.
 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.
 Args:
dimension: Dimension(s) to compute histogram on num_bins (int, optional): Number of bins bin_range (tuple optional): Lower and upper bounds of bins adjoin (bool, optional): Whether to adjoin histogram
 Returns:
AdjointLayout of element and histogram or just the histogram
 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)
 Args:
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
 matches(spec)[source]#
Whether the spec applies to this object.
 Args:
 spec: A function, spec or type to check for a match
A ‘type[[.group].label]’ string which is compared against the type, group and label of this object
A function which is given the object and returns a boolean.
An object type matched using isinstance.
 Returns:
bool: Whether the spec matched this object.
 property ndloc#
Returns ndloc indexer with support for gridded indexing.
Returns an ndloc object providing ndarray like indexing for gridded datasets. Follows NumPy array indexing conventions, allowing for indexing, slicing and selecting a list of indices on multidimensional 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]
, whereiy
andix
are integer indices along the y and x dimensions.Examples:
Index value in 2D array:
dataset.ndloc[3, 1]
Slice along yaxis of 2D array:
dataset.ndloc[2:5, :]
Vectorized (nonorthogonal) indexing along x and yaxes:
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.
 Args:
 *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.
 backend (optional): Backend to apply options to
Defaults to current selected backend
 clone (bool, 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 noop. 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.
 Args:
dimension: The dimension to compute the range on. data_range (bool): Compute range from data values dimension_range (bool): 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)
 Args:
 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 nonvarying key dimensions.x
 Args:
kdims (optional): New list of key dimensionsx vdims (optional): 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.
 Args:
label (str, optional): New label to apply to returned object group (str, optional): New group to apply to returned object depth (int, 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)
 Args:
samples: List of ndcoordinates to sample bounds: Bounds of the region to sample
Defined as twotuple for 1D sampling and fourtuple 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)
 Args:
 selection_expr: holoviews.dim predicate expression
specifying selection.
 selection_specs: List 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.
 Args:
by: Dimension(s) to sort by reverse (bool, optional): Reverse sort order
 Returns:
Sorted Dataset
 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.
 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.
 Args:
 args: Specify the output arguments and transforms as a
tuple of dimension specs and dim transforms
drop (bool): Whether to drop all variables not part of the transform keep_index (bool): 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
 traverse(fn=None, specs=None, full_breadth=True)[source]#
Traverses object returning matching items Traverses the set of children of the object, collecting the all objects matching the defined specs. Each object can be processed with the supplied function. Args:
fn (function, optional): Function applied to matched objects specs: List of specs to match
Specs must be types, functions or type[.group][.label] specs to select objects to return, by default applies to all objects.
 full_breadth: Whether to traverse all objects
Whether to traverse the full set of objects on each container or only the first.
 Returns:
list: List of objects that matched
 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 xcoordinate and the first value dimension represents the height of the line along the yaxis.
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.core.data.Dataset
: datatypeholoviews.element.chart.Chart
: kdims, vdimsgroup
= param.String(allow_refs=False, constant=True, default=’Curve’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3a6e380>)A string describing the data wrapped by the object.
 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.
 Args:
dimension: Dimension or dimension spec to add dim_pos (int): Integer index to insert dimension at dim_val (scalar 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.
 Args:
 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
 array(dimensions=None)[source]#
Convert dimension values to columnar array.
 Args:
dimensions: List of dimensions to return
 Returns:
Array of columns corresponding to each dimension
 clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)[source]#
Clones the object, overriding data and parameters.
 Args:
data: New data replacing the existing data shared_data (bool, optional): Whether to use existing data new_type (optional): Type to cast object to link (bool, 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
 Args:
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.
 Args:
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 inmemory format
 property dataset#
The Dataset that this object was created from
 property ddims#
The list of deep dimensions
 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.
 Args:
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.
 Args:
dimension: The dimension to return values for expanded (bool, 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
flat (bool, optional): Whether to flatten array
 Returns:
NumPy array of values along the requested dimension
 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.
 Args:
 selection: Type of dimensions to return
The type of dimension, i.e. one of ‘key’, ‘value’, ‘constant’ or ‘all’.
 label: Whether 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
 get_dimension(dimension, default=None, strict=False)[source]#
Get a Dimension object by name or index.
 Args:
dimension: Dimension to look up by name or integer index default (optional): Value returned if Dimension not found strict (bool, optional): Raise a KeyError if not found
 Returns:
Dimension object for the requested dimension or default
 get_dimension_index(dimension)[source]#
Get the index of the requested dimension.
 Args:
dimension: Dimension to look up by name or by index
 Returns:
Integer index of 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.
 Args:
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 dictionarylike) containing the groups.
 Args:
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.
 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.
 Args:
dimension: Dimension(s) to compute histogram on num_bins (int, optional): Number of bins bin_range (tuple optional): Lower and upper bounds of bins adjoin (bool, optional): Whether to adjoin histogram
 Returns:
AdjointLayout of element and histogram or just the histogram
 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)
 Args:
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
 matches(spec)[source]#
Whether the spec applies to this object.
 Args:
 spec: A function, spec or type to check for a match
A ‘type[[.group].label]’ string which is compared against the type, group and label of this object
A function which is given the object and returns a boolean.
An object type matched using isinstance.
 Returns:
bool: Whether the spec matched this object.
 property ndloc#
Returns ndloc indexer with support for gridded indexing.
Returns an ndloc object providing ndarray like indexing for gridded datasets. Follows NumPy array indexing conventions, allowing for indexing, slicing and selecting a list of indices on multidimensional 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]
, whereiy
andix
are integer indices along the y and x dimensions.Examples:
Index value in 2D array:
dataset.ndloc[3, 1]
Slice along yaxis of 2D array:
dataset.ndloc[2:5, :]
Vectorized (nonorthogonal) indexing along x and yaxes:
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.
 Args:
 *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.
 backend (optional): Backend to apply options to
Defaults to current selected backend
 clone (bool, 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 noop. 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.
 Args:
dimension: The dimension to compute the range on. data_range (bool): Compute range from data values dimension_range (bool): 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)
 Args:
 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 nonvarying key dimensions.x
 Args:
kdims (optional): New list of key dimensionsx vdims (optional): 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.
 Args:
label (str, optional): New label to apply to returned object group (str, optional): New group to apply to returned object depth (int, 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)
 Args:
samples: List of ndcoordinates to sample bounds: Bounds of the region to sample
Defined as twotuple for 1D sampling and fourtuple 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)
 Args:
 selection_expr: holoviews.dim predicate expression
specifying selection.
 selection_specs: List 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.
 Args:
by: Dimension(s) to sort by reverse (bool, 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.
 Args:
 args: Specify the output arguments and transforms as a
tuple of dimension specs and dim transforms
drop (bool): Whether to drop all variables not part of the transform keep_index (bool): 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
 traverse(fn=None, specs=None, full_breadth=True)[source]#
Traverses object returning matching items Traverses the set of children of the object, collecting the all objects matching the defined specs. Each object can be processed with the supplied function. Args:
fn (function, optional): Function applied to matched objects specs: List of specs to match
Specs must be types, functions or type[.group][.label] specs to select objects to return, by default applies to all objects.
 full_breadth: Whether to traverse all objects
Whether to traverse the full set of objects on each container or only the first.
 Returns:
list: List of objects that matched
 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.
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, kdims, vdimsgroup
= param.String(allow_refs=False, constant=True, default=’Dataset’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3a6f3d0>)A string describing the data wrapped by the object.
datatype
= param.List(allow_refs=False, bounds=(0, None), default=[‘dataframe’, ‘dictionary’, ‘grid’, ‘xarray’, ‘multitabular’, ‘spatialpandas’, ‘dask_spatialpandas’, ‘dask’, ‘cuDF’, ‘array’, ‘ibis’], label=’Datatype’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3a6dfc0>)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.
 Args:
dimension: Dimension or dimension spec to add dim_pos (int): Integer index to insert dimension at dim_val (scalar 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.
 Args:
 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
 array(dimensions=None)[source]#
Convert dimension values to columnar array.
 Args:
dimensions: List of dimensions to return
 Returns:
Array of columns corresponding to each dimension
 clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)[source]#
Clones the object, overriding data and parameters.
 Args:
data: New data replacing the existing data shared_data (bool, optional): Whether to use existing data new_type (optional): Type to cast object to link (bool, 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
 Args:
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.
 Args:
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 inmemory format
 property dataset#
The Dataset that this object was created from
 property ddims#
The list of deep dimensions
 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.
 Args:
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.
 Args:
dimension: The dimension to return values for expanded (bool, 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
flat (bool, optional): Whether to flatten array
 Returns:
NumPy array of values along the requested dimension
 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.
 Args:
 selection: Type of dimensions to return
The type of dimension, i.e. one of ‘key’, ‘value’, ‘constant’ or ‘all’.
 label: Whether 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
 get_dimension(dimension, default=None, strict=False)[source]#
Get a Dimension object by name or index.
 Args:
dimension: Dimension to look up by name or integer index default (optional): Value returned if Dimension not found strict (bool, optional): Raise a KeyError if not found
 Returns:
Dimension object for the requested dimension or default
 get_dimension_index(dimension)[source]#
Get the index of the requested dimension.
 Args:
dimension: Dimension to look up by name or by index
 Returns:
Integer index of 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.
 Args:
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 dictionarylike) containing the groups.
 Args:
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.
 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.
 Args:
dimension: Dimension(s) to compute histogram on num_bins (int, optional): Number of bins bin_range (tuple optional): Lower and upper bounds of bins adjoin (bool, optional): Whether to adjoin histogram
 Returns:
AdjointLayout of element and histogram or just the histogram
 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)
 Args:
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
 matches(spec)[source]#
Whether the spec applies to this object.
 Args:
 spec: A function, spec or type to check for a match
A ‘type[[.group].label]’ string which is compared against the type, group and label of this object
A function which is given the object and returns a boolean.
An object type matched using isinstance.
 Returns:
bool: Whether the spec matched this object.
 property ndloc#
Returns ndloc indexer with support for gridded indexing.
Returns an ndloc object providing ndarray like indexing for gridded datasets. Follows NumPy array indexing conventions, allowing for indexing, slicing and selecting a list of indices on multidimensional 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]
, whereiy
andix
are integer indices along the y and x dimensions.Examples:
Index value in 2D array:
dataset.ndloc[3, 1]
Slice along yaxis of 2D array:
dataset.ndloc[2:5, :]
Vectorized (nonorthogonal) indexing along x and yaxes:
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.
 Args:
 *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.
 backend (optional): Backend to apply options to
Defaults to current selected backend
 clone (bool, 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 noop. 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.
 Args:
dimension: The dimension to compute the range on. data_range (bool): Compute range from data values dimension_range (bool): 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)
 Args:
 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 nonvarying key dimensions.x
 Args:
kdims (optional): New list of key dimensionsx vdims (optional): 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.
 Args:
label (str, optional): New label to apply to returned object group (str, optional): New group to apply to returned object depth (int, 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)
 Args:
samples: List of ndcoordinates to sample bounds: Bounds of the region to sample
Defined as twotuple for 1D sampling and fourtuple 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)
 Args:
 selection_expr: holoviews.dim predicate expression
specifying selection.
 selection_specs: List 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.
 Args:
by: Dimension(s) to sort by reverse (bool, 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.
 Args:
 args: Specify the output arguments and transforms as a
tuple of dimension specs and dim transforms
drop (bool): Whether to drop all variables not part of the transform keep_index (bool): 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
 traverse(fn=None, specs=None, full_breadth=True)[source]#
Traverses object returning matching items Traverses the set of children of the object, collecting the all objects matching the defined specs. Each object can be processed with the supplied function. Args:
fn (function, optional): Function applied to matched objects specs: List of specs to match
Specs must be types, functions or type[.group][.label] specs to select objects to return, by default applies to all objects.
 full_breadth: Whether to traverse all objects
Whether to traverse the full set of objects on each container or only the first.
 Returns:
list: List of objects that matched
 class holoviews.element.Distribution(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
Selection1DExpr
,StatisticsElement
Distribution elements provides a representation for a onedimensional 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.
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.core.data.Dataset
: datatypegroup
= param.String(allow_refs=False, constant=True, default=’Distribution’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3ad37f0>)A string describing the data wrapped by the object.
kdims
= param.List(allow_refs=False, bounds=(1, 1), default=[Dimension(‘Value’)], label=’Kdims’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3ad0fd0>)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 multidimensional indexing operation. Aliased with key_dimensions.
vdims
= param.List(allow_refs=False, bounds=(0, 1), default=[Dimension(‘Density’)], label=’Vdims’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3ad13c0>)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.
 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.
 Args:
dimension: Dimension or dimension spec to add dim_pos (int): Integer index to insert dimension at dim_val (scalar 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.
 Args:
 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
 array(dimensions=None)[source]#
Convert dimension values to columnar array.
 Args:
dimensions: List of dimensions to return
 Returns:
Array of columns corresponding to each dimension
 clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)[source]#
Clones the object, overriding data and parameters.
 Args:
data: New data replacing the existing data shared_data (bool, optional): Whether to use existing data new_type (optional): Type to cast object to link (bool, 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
 Args:
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.
 Args:
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 inmemory format
 property dataset#
The Dataset that this object was created from
 property ddims#
The list of deep dimensions
 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.
 Args:
dimensions: Dimensions to return as columns multi_index: Convert key dimensions to (multi)index
 Returns:
DataFrame of columns corresponding to each dimension
 dimension_values(dim, expanded=True, flat=True)[source]#
Return the values along the requested dimension.
 Args:
dimension: The dimension to return values for expanded (bool, 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
flat (bool, optional): Whether to flatten array
 Returns:
NumPy array of values along the requested dimension
 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.
 Args:
 selection: Type of dimensions to return
The type of dimension, i.e. one of ‘key’, ‘value’, ‘constant’ or ‘all’.
 label: Whether 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
 get_dimension(dimension, default=None, strict=False)[source]#
Get a Dimension object by name or index.
 Args:
dimension: Dimension to look up by name or integer index default (optional): Value returned if Dimension not found strict (bool, optional): Raise a KeyError if not found
 Returns:
Dimension object for the requested dimension or default
 get_dimension_index(dimension)[source]#
Get the index of the requested dimension.
 Args:
dimension: Dimension to look up by name or by index
 Returns:
Integer index of 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.
 Args:
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 dictionarylike) containing the groups.
 Args:
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.
 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.
 Args:
dimension: Dimension(s) to compute histogram on num_bins (int, optional): Number of bins bin_range (tuple optional): Lower and upper bounds of bins adjoin (bool, optional): Whether to adjoin histogram
 Returns:
AdjointLayout of element and histogram or just the histogram
 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)
 Args:
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
 matches(spec)[source]#
Whether the spec applies to this object.
 Args:
 spec: A function, spec or type to check for a match
A ‘type[[.group].label]’ string which is compared against the type, group and label of this object
A function which is given the object and returns a boolean.
An object type matched using isinstance.
 Returns:
bool: Whether the spec matched this object.
 property ndloc#
Returns ndloc indexer with support for gridded indexing.
Returns an ndloc object providing ndarray like indexing for gridded datasets. Follows NumPy array indexing conventions, allowing for indexing, slicing and selecting a list of indices on multidimensional 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]
, whereiy
andix
are integer indices along the y and x dimensions.Examples:
Index value in 2D array:
dataset.ndloc[3, 1]
Slice along yaxis of 2D array:
dataset.ndloc[2:5, :]
Vectorized (nonorthogonal) indexing along x and yaxes:
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.
 Args:
 *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.
 backend (optional): Backend to apply options to
Defaults to current selected backend
 clone (bool, 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 noop. 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.
 Args:
dimension: The dimension to compute the range on. data_range (bool): Compute range from data values dimension_range (bool): 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)
 Args:
 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 nonvarying key dimensions.x
 Args:
kdims (optional): New list of key dimensionsx vdims (optional): 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.
 Args:
label (str, optional): New label to apply to returned object group (str, optional): New group to apply to returned object depth (int, 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)
 Args:
samples: List of ndcoordinates to sample bounds: Bounds of the region to sample
Defined as twotuple for 1D sampling and fourtuple 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)
 Args:
 selection_expr: holoviews.dim predicate expression
specifying selection.
 selection_specs: List 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.
 Args:
by: Dimension(s) to sort by reverse (bool, 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.
 Args:
 args: Specify the output arguments and transforms as a
tuple of dimension specs and dim transforms
drop (bool): Whether to drop all variables not part of the transform keep_index (bool): 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
 traverse(fn=None, specs=None, full_breadth=True)[source]#
Traverses object returning matching items Traverses the set of children of the object, collecting the all objects matching the defined specs. Each object can be processed with the supplied function. Args:
fn (function, optional): Function applied to matched objects specs: List of specs to match
Specs must be types, functions or type[.group][.label] specs to select objects to return, by default applies to all objects.
 full_breadth: Whether to traverse all objects
Whether to traverse the full set of objects on each container or only the first.
 Returns:
list: List of objects that matched
 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.
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, kdims, vdimsgroup
= param.String(allow_refs=False, constant=True, default=’Div’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3ad3820>)A string describing the data wrapped by the object.
 array(dimensions=None)[source]#
Convert dimension values to columnar array.
 Args:
dimensions: List of dimensions to return
 Returns:
Array of columns corresponding to each dimension
 clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)[source]#
Clones the object, overriding data and parameters.
 Args:
data: New data replacing the existing data shared_data (bool, optional): Whether to use existing data new_type (optional): Type to cast object to link (bool, 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, **kwargs)[source]#
Snap list or dict of coordinates to closest position.
 Args:
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
 property ddims#
The list of deep dimensions
 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.
 Args:
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.
 Args:
dimension: The dimension to return values for expanded (bool, 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
flat (bool, optional): Whether to flatten array
 Returns:
NumPy array of values along the requested dimension
 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.
 Args:
 selection: Type of dimensions to return
The type of dimension, i.e. one of ‘key’, ‘value’, ‘constant’ or ‘all’.
 label: Whether 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
 get_dimension(dimension, default=None, strict=False)[source]#
Get a Dimension object by name or index.
 Args:
dimension: Dimension to look up by name or integer index default (optional): Value returned if Dimension not found strict (bool, optional): Raise a KeyError if not found
 Returns:
Dimension object for the requested dimension or default
 get_dimension_index(dimension)[source]#
Get the index of the requested dimension.
 Args:
dimension: Dimension to look up by name or by index
 Returns:
Integer index of 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.
 Args:
dimension: Dimension to look up by name or by index
 Returns:
Declared type of values along the 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.
 Args:
dimension: Dimension(s) to compute histogram on num_bins (int, optional): Number of bins bin_range (tuple optional): Lower and upper bounds of bins adjoin (bool, optional): Whether to adjoin histogram
 Returns:
AdjointLayout of element and histogram or just the histogram
 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)
 Args:
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
 matches(spec)[source]#
Whether the spec applies to this object.
 Args:
 spec: A function, spec or type to check for a match
A ‘type[[.group].label]’ string which is compared against the type, group and label of this object
A function which is given the object and returns a boolean.
An object type matched using isinstance.
 Returns:
bool: Whether the spec matched this object.
 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.
 Args:
 *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.
 backend (optional): Backend to apply options to
Defaults to current selected backend
 clone (bool, 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
 range(dimension, data_range=True, dimension_range=True)[source]#
Return the lower and upper bounds of values along dimension.
 Args:
dimension: The dimension to compute the range on. data_range (bool): Compute range from data values dimension_range (bool): 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, **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)
 Args:
 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.
 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.
 Args:
label (str, optional): New label to apply to returned object group (str, optional): New group to apply to returned object depth (int, 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=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)
 Args:
samples: List of ndcoordinates to sample bounds: Bounds of the region to sample
Defined as twotuple for 1D sampling and fourtuple 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_specs=None, **kwargs)[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])
 Args:
 selection_specs: List 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
 traverse(fn=None, specs=None, full_breadth=True)[source]#
Traverses object returning matching items Traverses the set of children of the object, collecting the all objects matching the defined specs. Each object can be processed with the supplied function. Args:
fn (function, optional): Function applied to matched objects specs: List of specs to match
Specs must be types, functions or type[.group][.label] specs to select objects to return, by default applies to all objects.
 full_breadth: Whether to traverse all objects
Whether to traverse the full set of objects on each container or only the first.
 Returns:
list: List of objects that matched
 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.
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.element.geom.Geometry
: kdims, vdimsholoviews.element.path.Path
: datatypegroup
= param.String(allow_refs=False, constant=True, default=’EdgePaths’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3ad3610>)A string describing the data wrapped by the object.
 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.
 Args:
dimension: Dimension or dimension spec to add dim_pos (int): Integer index to insert dimension at dim_val (scalar 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.
 Args:
 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
 array(dimensions=None)[source]#
Convert dimension values to columnar array.
 Args:
dimensions: List of dimensions to return
 Returns:
Array of columns corresponding to each dimension
 clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)[source]#
Clones the object, overriding data and parameters.
 Args:
data: New data replacing the existing data shared_data (bool, optional): Whether to use existing data new_type (optional): Type to cast object to link (bool, 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
 Args:
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.
 Args:
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 inmemory format
 property dataset#
The Dataset that this object was created from
 property ddims#
The list of deep dimensions
 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.
 Args:
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.
 Args:
dimension: The dimension to return values for expanded (bool, 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
flat (bool, optional): Whether to flatten array
 Returns:
NumPy array of values along the requested dimension
 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.
 Args:
 selection: Type of dimensions to return
The type of dimension, i.e. one of ‘key’, ‘value’, ‘constant’ or ‘all’.
 label: Whether 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
 get_dimension(dimension, default=None, strict=False)[source]#
Get a Dimension object by name or index.
 Args:
dimension: Dimension to look up by name or integer index default (optional): Value returned if Dimension not found strict (bool, optional): Raise a KeyError if not found
 Returns:
Dimension object for the requested dimension or default
 get_dimension_index(dimension)[source]#
Get the index of the requested dimension.
 Args:
dimension: Dimension to look up by name or by index
 Returns:
Integer index of 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.
 Args:
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 dictionarylike) containing the groups.
 Args:
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.
 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.
 Args:
dimension: Dimension(s) to compute histogram on num_bins (int, optional): Number of bins bin_range (tuple optional): Lower and upper bounds of bins adjoin (bool, optional): Whether to adjoin histogram
 Returns:
AdjointLayout of element and histogram or just the histogram
 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)
 Args:
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
 matches(spec)[source]#
Whether the spec applies to this object.
 Args:
 spec: A function, spec or type to check for a match
A ‘type[[.group].label]’ string which is compared against the type, group and label of this object
A function which is given the object and returns a boolean.
An object type matched using isinstance.
 Returns:
bool: Whether the spec matched this object.
 property ndloc#
Returns ndloc indexer with support for gridded indexing.
Returns an ndloc object providing ndarray like indexing for gridded datasets. Follows NumPy array indexing conventions, allowing for indexing, slicing and selecting a list of indices on multidimensional 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]
, whereiy
andix
are integer indices along the y and x dimensions.Examples:
Index value in 2D array:
dataset.ndloc[3, 1]
Slice along yaxis of 2D array:
dataset.ndloc[2:5, :]
Vectorized (nonorthogonal) indexing along x and yaxes:
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.
 Args:
 *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.
 backend (optional): Backend to apply options to
Defaults to current selected backend
 clone (bool, 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 noop. 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.
 Args:
dimension: The dimension to compute the range on. data_range (bool): Compute range from data values dimension_range (bool): 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)
 Args:
 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 nonvarying key dimensions.x
 Args:
kdims (optional): New list of key dimensionsx vdims (optional): 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.
 Args:
label (str, optional): New label to apply to returned object group (str, optional): New group to apply to returned object depth (int, 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)
 Args:
samples: List of ndcoordinates to sample bounds: Bounds of the region to sample
Defined as twotuple for 1D sampling and fourtuple 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)
 Args:
 selection_expr: holoviews.dim predicate expression
specifying selection.
 selection_specs: List 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.
 Args:
by: Dimension(s) to sort by reverse (bool, optional): Reverse sort order
 Returns:
Sorted Dataset
 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.
 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.
 Args:
 args: Specify the output arguments and transforms as a
tuple of dimension specs and dim transforms
drop (bool): Whether to drop all variables not part of the transform keep_index (bool): 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
 traverse(fn=None, specs=None, full_breadth=True)[source]#
Traverses object returning matching items Traverses the set of children of the object, collecting the all objects matching the defined specs. Each object can be processed with the supplied function. Args:
fn (function, optional): Function applied to matched objects specs: List of specs to match
Specs must be types, functions or type[.group][.label] specs to select objects to return, by default applies to all objects.
 full_breadth: Whether to traverse all objects
Whether to traverse the full set of objects on each container or only the first.
 Returns:
list: List of objects that matched
 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.
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, kdims, vdimsgroup
= param.String(allow_refs=False, constant=True, default=’Element’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3960b20>)A string describing the data wrapped by the object.
 array(dimensions=None)[source]#
Convert dimension values to columnar array.
 Args:
dimensions: List of dimensions to return
 Returns:
Array of columns corresponding to each dimension
 clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)[source]#
Clones the object, overriding data and parameters.
 Args:
data: New data replacing the existing data shared_data (bool, optional): Whether to use existing data new_type (optional): Type to cast object to link (bool, 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, **kwargs)[source]#
Snap list or dict of coordinates to closest position.
 Args:
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
 property ddims#
The list of deep dimensions
 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.
 Args:
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.
 Args:
dimension: The dimension to return values for expanded (bool, 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
flat (bool, optional): Whether to flatten array
 Returns:
NumPy array of values along the requested dimension
 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.
 Args:
 selection: Type of dimensions to return
The type of dimension, i.e. one of ‘key’, ‘value’, ‘constant’ or ‘all’.
 label: Whether 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
 get_dimension(dimension, default=None, strict=False)[source]#
Get a Dimension object by name or index.
 Args:
dimension: Dimension to look up by name or integer index default (optional): Value returned if Dimension not found strict (bool, optional): Raise a KeyError if not found
 Returns:
Dimension object for the requested dimension or default
 get_dimension_index(dimension)[source]#
Get the index of the requested dimension.
 Args:
dimension: Dimension to look up by name or by index
 Returns:
Integer index of 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.
 Args:
dimension: Dimension to look up by name or by index
 Returns:
Declared type of values along the 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.
 Args:
dimension: Dimension(s) to compute histogram on num_bins (int, optional): Number of bins bin_range (tuple optional): Lower and upper bounds of bins adjoin (bool, optional): Whether to adjoin histogram
 Returns:
AdjointLayout of element and histogram or just the histogram
 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)
 Args:
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
 matches(spec)[source]#
Whether the spec applies to this object.
 Args:
 spec: A function, spec or type to check for a match
A ‘type[[.group].label]’ string which is compared against the type, group and label of this object
A function which is given the object and returns a boolean.
An object type matched using isinstance.
 Returns:
bool: Whether the spec matched this object.
 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.
 Args:
 *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.
 backend (optional): Backend to apply options to
Defaults to current selected backend
 clone (bool, 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
 range(dimension, data_range=True, dimension_range=True)[source]#
Return the lower and upper bounds of values along dimension.
 Args:
dimension: The dimension to compute the range on. data_range (bool): Compute range from data values dimension_range (bool): 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, **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)
 Args:
 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.
 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.
 Args:
label (str, optional): New label to apply to returned object group (str, optional): New group to apply to returned object depth (int, 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=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)
 Args:
samples: List of ndcoordinates to sample bounds: Bounds of the region to sample
Defined as twotuple for 1D sampling and fourtuple 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_specs=None, **kwargs)[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])
 Args:
 selection_specs: List 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
 traverse(fn=None, specs=None, full_breadth=True)[source]#
Traverses object returning matching items Traverses the set of children of the object, collecting the all objects matching the defined specs. Each object can be processed with the supplied function. Args:
fn (function, optional): Function applied to matched objects specs: List of specs to match
Specs must be types, functions or type[.group][.label] specs to select objects to return, by default applies to all objects.
 full_breadth: Whether to traverse all objects
Whether to traverse the full set of objects on each container or only the first.
 Returns:
list: List of objects that matched
 class holoviews.element.Ellipse(*args, **kwargs)[source]#
Bases:
BaseShape
Draw an axisaligned 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.
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.element.geom.Geometry
: kdims, vdimsholoviews.element.path.Path
: datatypegroup
= param.String(allow_refs=False, constant=True, default=’Ellipse’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3961ea0>)The assigned group name.
x
= param.Number(allow_refs=False, default=0, inclusive_bounds=(True, True), label=’X’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3963b80>)The xposition of the ellipse center.
y
= param.Number(allow_refs=False, default=0, inclusive_bounds=(True, True), label=’Y’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d39611b0>)The yposition of the ellipse center.
width
= param.Number(allow_refs=False, default=1, inclusive_bounds=(True, True), label=’Width’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3961960>)The width of the ellipse.
height
= param.Number(allow_refs=False, default=1, inclusive_bounds=(True, True), label=’Height’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d39615d0>)The height of the ellipse.
orientation
= param.Number(allow_refs=False, default=0, inclusive_bounds=(True, True), label=’Orientation’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3963cd0>)Orientation in the Cartesian coordinate system, the counterclockwise angle in radians between the first axis and the horizontal.
aspect
= param.Number(allow_refs=False, default=1.0, inclusive_bounds=(True, True), label=’Aspect’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d3963b50>)Optional multiplier applied to the diameter to compute the width in cases where only the diameter value is set.
samples
= param.Number(allow_refs=False, default=100, inclusive_bounds=(True, True), label=’Samples’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d39618d0>)The sample count used to draw the ellipse.
 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.
 Args:
dimension: Dimension or dimension spec to add dim_pos (int): Integer index to insert dimension at dim_val (scalar 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.
 Args:
 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
 array(dimensions=None)[source]#
Convert dimension values to columnar array.
 Args:
dimensions: List of dimensions to return
 Returns:
Array of columns corresponding to each dimension
 clone(*args, **overrides)[source]#
Returns a clone of the object with matching parameter values containing the specified args and kwargs.
 closest(coords=None, **kwargs)[source]#
Snaps coordinate(s) to closest coordinate in Dataset
 Args:
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.
 Args:
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 inmemory format
 property dataset#
The Dataset that this object was created from
 property ddims#
The list of deep dimensions
 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.
 Args:
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.
 Args:
dimension: The dimension to return values for expanded (bool, 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
flat (bool, optional): Whether to flatten array
 Returns:
NumPy array of values along the requested dimension
 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.
 Args:
 selection: Type of dimensions to return
The type of dimension, i.e. one of ‘key’, ‘value’, ‘constant’ or ‘all’.
 label: Whether 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
 get_dimension(dimension, default=None, strict=False)[source]#
Get a Dimension object by name or index.
 Args:
dimension: Dimension to look up by name or integer index default (optional): Value returned if Dimension not found strict (bool, optional): Raise a KeyError if not found
 Returns:
Dimension object for the requested dimension or default
 get_dimension_index(dimension)[source]#
Get the index of the requested dimension.
 Args:
dimension: Dimension to look up by name or by index
 Returns:
Integer index of 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.
 Args:
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 dictionarylike) containing the groups.
 Args:
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.
 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.
 Args:
dimension: Dimension(s) to compute histogram on num_bins (int, optional): Number of bins bin_range (tuple optional): Lower and upper bounds of bins adjoin (bool, optional): Whether to adjoin histogram
 Returns:
AdjointLayout of element and histogram or just the histogram
 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)
 Args:
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
 matches(spec)[source]#
Whether the spec applies to this object.
 Args:
 spec: A function, spec or type to check for a match
A ‘type[[.group].label]’ string which is compared against the type, group and label of this object
A function which is given the object and returns a boolean.
An object type matched using isinstance.
 Returns:
bool: Whether the spec matched this object.
 property ndloc#
Returns ndloc indexer with support for gridded indexing.
Returns an ndloc object providing ndarray like indexing for gridded datasets. Follows NumPy array indexing conventions, allowing for indexing, slicing and selecting a list of indices on multidimensional 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]
, whereiy
andix
are integer indices along the y and x dimensions.Examples:
Index value in 2D array:
dataset.ndloc[3, 1]
Slice along yaxis of 2D array:
dataset.ndloc[2:5, :]
Vectorized (nonorthogonal) indexing along x and yaxes:
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.
 Args:
 *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.
 backend (optional): Backend to apply options to
Defaults to current selected backend
 clone (bool, 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 noop. 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.
 Args:
dimension: The dimension to compute the range on. data_range (bool): Compute range from data values dimension_range (bool): 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)
 Args:
 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 nonvarying key dimensions.x
 Args:
kdims (optional): New list of key dimensionsx vdims (optional): 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.
 Args:
label (str, optional): New label to apply to returned object group (str, optional): New group to apply to returned object depth (int, 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)
 Args:
samples: List of ndcoordinates to sample bounds: Bounds of the region to sample
Defined as twotuple for 1D sampling and fourtuple 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)
 Args:
 selection_expr: holoviews.dim predicate expression
specifying selection.
 selection_specs: List 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.
 Args:
by: Dimension(s) to sort by reverse (bool, optional): Reverse sort order
 Returns:
Sorted Dataset
 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.
 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.
 Args:
 args: Specify the output arguments and transforms as a
tuple of dimension specs and dim transforms
drop (bool): Whether to drop all variables not part of the transform keep_index (bool): 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
 traverse(fn=None, specs=None, full_breadth=True)[source]#
Traverses object returning matching items Traverses the set of children of the object, collecting the all objects matching the defined specs. Each object can be processed with the supplied function. Args:
fn (function, optional): Function applied to matched objects specs: List of specs to match
Specs must be types, functions or type[.group][.label] specs to select objects to return, by default applies to all objects.
 full_breadth: Whether to traverse all objects
Whether to traverse the full set of objects on each container or only the first.
 Returns:
list: List of objects that matched
 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 xaxis and the first value dimension corresponds to the location along the yaxis and one or two extra value dimensions corresponding to the symmetric or asymmetric errors either along xaxis or yaxis. 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 yaxis. A parameter horizontal, when set True, will define the errors along the xaxis.
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.element.Element2D
: extentsholoviews.core.data.Dataset
: datatypegroup
= param.String(allow_refs=False, constant=True, default=’ErrorBars’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d39b6dd0>)A string describing the quantity measured by the ErrorBars object.
vdims
= param.List(allow_refs=False, bounds=(1, None), constant=True, default=[Dimension(‘y’), Dimension(‘yerror’)], label=’Vdims’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d39b66b0>)The value dimensions of the Chart, usually corresponding to a number of dependent variables.
horizontal
= param.Boolean(allow_refs=False, default=False, label=’Horizontal’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d39b6dd0>)Whether the errors are along yaxis (vertical) or xaxis.
 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.
 Args:
dimension: Dimension or dimension spec to add dim_pos (int): Integer index to insert dimension at dim_val (scalar 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.
 Args:
 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
 array(dimensions=None)[source]#
Convert dimension values to columnar array.
 Args:
dimensions: List of dimensions to return
 Returns:
Array of columns corresponding to each dimension
 clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)[source]#
Clones the object, overriding data and parameters.
 Args:
data: New data replacing the existing data shared_data (bool, optional): Whether to use existing data new_type (optional): Type to cast object to link (bool, 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
 Args:
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.
 Args:
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 inmemory format
 property dataset#
The Dataset that this object was created from
 property ddims#
The list of deep dimensions
 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.
 Args:
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.
 Args:
dimension: The dimension to return values for expanded (bool, 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
flat (bool, optional): Whether to flatten array
 Returns:
NumPy array of values along the requested dimension
 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.
 Args:
 selection: Type of dimensions to return
The type of dimension, i.e. one of ‘key’, ‘value’, ‘constant’ or ‘all’.
 label: Whether 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
 get_dimension(dimension, default=None, strict=False)[source]#
Get a Dimension object by name or index.
 Args:
dimension: Dimension to look up by name or integer index default (optional): Value returned if Dimension not found strict (bool, optional): Raise a KeyError if not found
 Returns:
Dimension object for the requested dimension or default
 get_dimension_index(dimension)[source]#
Get the index of the requested dimension.
 Args:
dimension: Dimension to look up by name or by index
 Returns:
Integer index of 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.
 Args:
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 dictionarylike) containing the groups.
 Args:
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.
 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.
 Args:
dimension: Dimension(s) to compute histogram on num_bins (int, optional): Number of bins bin_range (tuple optional): Lower and upper bounds of bins adjoin (bool, optional): Whether to adjoin histogram
 Returns:
AdjointLayout of element and histogram or just the histogram
 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)
 Args:
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
 matches(spec)[source]#
Whether the spec applies to this object.
 Args:
 spec: A function, spec or type to check for a match
A ‘type[[.group].label]’ string which is compared against the type, group and label of this object
A function which is given the object and returns a boolean.
An object type matched using isinstance.
 Returns:
bool: Whether the spec matched this object.
 property ndloc#
Returns ndloc indexer with support for gridded indexing.
Returns an ndloc object providing ndarray like indexing for gridded datasets. Follows NumPy array indexing conventions, allowing for indexing, slicing and selecting a list of indices on multidimensional 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]
, whereiy
andix
are integer indices along the y and x dimensions.Examples:
Index value in 2D array:
dataset.ndloc[3, 1]
Slice along yaxis of 2D array:
dataset.ndloc[2:5, :]
Vectorized (nonorthogonal) indexing along x and yaxes:
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.
 Args:
 *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.
 backend (optional): Backend to apply options to
Defaults to current selected backend
 clone (bool, 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 noop. 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.
Range of the ydimension includes the symmetric or asymmetric error.
 Args:
dimension: The dimension to compute the range on. data_range (bool): Compute range from data values dimension_range (bool): 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)
 Args:
 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 nonvarying key dimensions.x
 Args:
kdims (optional): New list of key dimensionsx vdims (optional): 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.
 Args:
label (str, optional): New label to apply to returned object group (str, optional): New group to apply to returned object depth (int, 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)
 Args:
samples: List of ndcoordinates to sample bounds: Bounds of the region to sample
Defined as twotuple for 1D sampling and fourtuple 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)
 Args:
 selection_expr: holoviews.dim predicate expression
specifying selection.
 selection_specs: List 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.
 Args:
by: Dimension(s) to sort by reverse (bool, 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.
 Args:
 args: Specify the output arguments and transforms as a
tuple of dimension specs and dim transforms
drop (bool): Whether to drop all variables not part of the transform keep_index (bool): 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
 traverse(fn=None, specs=None, full_breadth=True)[source]#
Traverses object returning matching items Traverses the set of children of the object, collecting the all objects matching the defined specs. Each object can be processed with the supplied function. Args:
fn (function, optional): Function applied to matched objects specs: List of specs to match
Specs must be types, functions or type[.group][.label] specs to select objects to return, by default applies to all objects.
 full_breadth: Whether to traverse all objects
Whether to traverse the full set of objects on each container or only the first.
 Returns:
list: List of objects that matched
 class holoviews.element.Graph(data=None, kdims=None, vdims=None, **kwargs)[source]#

Graph is highlevel 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.
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, vdimsholoviews.core.element.Element2D
: extentsholoviews.core.data.Dataset
: datatypegroup
= param.String(allow_refs=False, constant=True, default=’Graph’, label=’Group’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d39b50c0>)A string describing the data wrapped by the object.
kdims
= param.List(allow_refs=False, bounds=(2, 2), default=[Dimension(‘start’), Dimension(‘end’)], label=’Kdims’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x7f52d39b5480>)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 multidimensional indexing operation. Aliased with key_dimensions.
 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.
 Args:
dimension: Dimension or dimension spec to add dim_pos (int): Integer index to insert dimension at dim_val (scalar 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.
 Args:
 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
 array(dimensions=None)[source]#
Convert dimension values to columnar array.
 Args:
dimensions: List of dimensions to return
 Returns:
Array of columns corresponding to each dimension
 clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)[source]#
Clones the object, overriding data and parameters.
 Args:
data: New data replacing the existing data shared_data (bool, optional): Whether to use existing data new_type (optional): Type to cast object to link (bool, 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
 Args:
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.
 Args:
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 inmemory format
 property dataset#
The Dataset that this object was created from
 property ddims#
The list of deep dimensions
 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.
 Args:
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.
 Args:
dimension: The dimension to return values for expanded (bool, 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
flat (bool, optional): Whether to flatten array
 Returns:
NumPy array of values along the requested dimension
 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.
 Args:
 selection: Type of dimensions to return
The type of dimension, i.e. one of ‘key’, ‘value’, ‘constant’ or ‘all’.
 label: Whether 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
 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 nonscalar attributes, such as lists or dictionaries will be ignored.
 Args:
G (networkx.Graph): Graph to convert to Graph element positions (dict 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
kwargs (dict): Keyword arguments for layout function
 Returns:
Graph element
 get_dimension(dimension, default=None, strict=False)[source]#
Get a Dimension object by name or index.
 Args:
dimension: Dimension to look up by name or integer index default (optional): Value returned if Dimension not found strict (bool, optional): Raise a KeyError if not found
 Returns:
Dimension object for the requested dimension or default
 get_dimension_index(dimension)[source]#
Get the index of the requested dimension.
 Args:
dimension: Dimension to look up by name or by index
 Returns:
Integer index of 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.
 Args:
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 dictionarylike) containing the groups.
 Args:
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.
 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.
 Args:
dimension: Dimension(s) to compute histogram on num_bins (int, optional): Number of bins bin_range (tuple optional): Lower and upper bounds of bins adjoin (bool, optional): Whether to adjoin histogram
 Returns:
AdjointLayout of element and histogram or just the histogram
 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)
 Args:
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
 matches(spec)[source]#
Whether the spec applies to this object.
 Args:
 spec: A function, spec or type to check for a match
A ‘type[[.group].label]’ string which is compared against the type, group and label of this object
A function which is given the object and returns a boolean.
An object type matched using isinstance.
 Returns:
bool: Whether the spec matched this object.
 property ndloc#
Returns ndloc indexer with support for gridded indexing.
Returns an ndloc object providing ndarray like indexing for gridded datasets. Follows NumPy array indexing conventions, allowing for indexing, slicing and selecting a list of indices on multidimensional 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]
, whereiy
andix
are integer indices along the y and x dimensions.Examples:
Index value in 2D array:
dataset.ndloc[3, 1]
Slice along yaxis of 2D array:
dataset.ndloc[2:5, :]
Vectorized (nonorthogonal) indexing along x and yaxes:
dataset.ndloc[[1, 2, 3], [0, 2, 3]]
 property nodes#
Computes the node positions the first time they are requested if no explicit node information was supplied.
 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.
 Args:
 *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.
 backend (optional): Backend to apply options to
Defaults to current selected backend
 clone (bool, 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 noop. 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(dimension, data_range=True, dimension_range=True)[source]#
Return the lower and upper bounds of values along dimension.
 Args:
dimension: The dimension to compute the range on. data_range (bool): Compute range from data values dimension_range (bool): 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)
 Args:
 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.