holoviews.core Package


core Package

class holoviews.core.AdjointLayout(data, **params)[source]

Bases: holoviews.core.dimension.Dimensioned

An AdjointLayout provides a convenient container to lay out some marginal plots next to a primary plot. This is often useful to display the marginal distributions of a plot next to the primary plot. AdjointLayout accepts a list of up to three elements, which are laid out as follows with the names ‘main’, ‘top’ and ‘right’:

3 | |

|___________|___| | | | 1: main | | | 2: right | 1 | 2 | 3: top | | | |___________|___|

Parameters inherited from:

kdims = param.List(bounds=(0, None), default=[Dimension(‘AdjointLayout’)])

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

clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)

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

property ddims

The list of deep dimensions

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

Return the values along the requested dimension.

Applies to the main object in the AdjointLayout.

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)

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(key, default=None)[source]

Returns the viewable corresponding to the supplied string or integer based key.

Args:

key: Numeric or string index: 0) ‘main’ 1) ‘right’ 2) ‘top’ default: Value returned if key not found

Returns:

Indexed value or supplied default

get_dimension(dimension, default=None, strict=False)

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)

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)

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

property group

Group inherited from main element

property label

Label inherited from main element

property main

Returns the main element in the AdjointLayout

map(map_fn, specs=None, clone=True)

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)

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, **kwargs)

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)

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

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

Clone object and apply new group and/or label.

Applies relabeling to child 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

property right

Returns the right marginal element in the AdjointLayout

select(selection_specs=None, **kwargs)

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

property top

Returns the top marginal element in the AdjointLayout

traverse(fn=None, specs=None, full_breadth=True)

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.core.AttrTree(items=None, identifier=None, parent=None, dir_mode='default')[source]

Bases: object

An AttrTree offers convenient, multi-level attribute access for collections of objects. AttrTree objects may also be combined together using the update method or merge classmethod. Here is an example of adding a ViewableElement to an AttrTree and accessing it:

>>> t = AttrTree()
>>> t.Example.Path = 1
>>> t.Example.Path                             
1
filter(path_filters)[source]

Filters the loaded AttrTree using the supplied path_filters.

property fixed

If fixed, no new paths can be created via attribute access

get(identifier, default=None)[source]

Get a node of the AttrTree using its path string.

Args:

identifier: Path string of the node to return default: Value to return if no node is found

Returns:

The indexed node of the AttrTree

items()[source]

Keys and nodes of the AttrTree

keys()[source]

Keys of nodes in the AttrTree

classmethod merge(trees)[source]

Merge a collection of AttrTree objects.

property path

Returns the path up to the root for the current node.

pop(identifier, default=None)[source]

Pop a node of the AttrTree using its path string.

Args:

identifier: Path string of the node to return default: Value to return if no node is found

Returns:

The node that was removed from the AttrTree

set_path(path, val)[source]

Set the given value at the supplied path where path is either a tuple of strings or a string in A.B.C format.

update(other)[source]

Updated the contents of the current AttrTree with the contents of a second AttrTree.

values()[source]

Nodes of the AttrTree

class holoviews.core.BoundingBox(**args)[source]

Bases: holoviews.core.boundingregion.BoundingRegion

A rectangular bounding box defined either by two points forming an axis-aligned rectangle (or simply a radius for a square).

centroid()

Return the coordinates of the center of this BoundingBox

contains(x, y)[source]

Returns true if the given point is contained within the bounding box, where all boundaries of the box are considered to be inclusive.

contains_exclusive(x, y)[source]

Return True if the given point is contained within the bounding box, where the bottom and right boundaries are considered exclusive.

containsbb_exclusive(x)[source]

Returns true if the given BoundingBox x is contained within the bounding box, where at least one of the boundaries of the box has to be exclusive.

containsbb_inclusive(x)[source]

Returns true if the given BoundingBox x is contained within the bounding box, including cases of exact match.

lbrt()[source]

return left,bottom,right,top values for the BoundingBox.

upperexclusive_contains(x, y)[source]

Returns true if the given point is contained within the bounding box, where the right and upper boundaries are exclusive, and the left and lower boundaries are inclusive. Useful for tiling a plane into non-overlapping regions.

class holoviews.core.BoundingEllipse(**args)[source]

Bases: holoviews.core.boundingregion.BoundingBox

Similar to BoundingBox, but the region is the ellipse inscribed within the rectangle.

centroid()

Return the coordinates of the center of this BoundingBox

contains(x, y)[source]

Returns true if the given point is contained within the bounding box, where all boundaries of the box are considered to be inclusive.

contains_exclusive(x, y)

Return True if the given point is contained within the bounding box, where the bottom and right boundaries are considered exclusive.

containsbb_exclusive(x)

Returns true if the given BoundingBox x is contained within the bounding box, where at least one of the boundaries of the box has to be exclusive.

containsbb_inclusive(x)

Returns true if the given BoundingBox x is contained within the bounding box, including cases of exact match.

lbrt()

return left,bottom,right,top values for the BoundingBox.

upperexclusive_contains(x, y)

Returns true if the given point is contained within the bounding box, where the right and upper boundaries are exclusive, and the left and lower boundaries are inclusive. Useful for tiling a plane into non-overlapping regions.

class holoviews.core.Collator(data=None, **params)[source]

Bases: holoviews.core.ndmapping.NdMapping

Collator is an NdMapping type which can merge any number of HoloViews components with whatever level of nesting by inserting the Collators key dimensions on the HoloMaps. If the items in the Collator do not contain HoloMaps they will be created. Collator also supports filtering of Tree structures and dropping of constant dimensions.

Parameters inherited from:

group = param.String(default=’Collator’)

A string describing the data wrapped by the object.

vdims = param.List(bounds=(0, None), default=[])

Collator operates on HoloViews objects, if vdims are specified a value_transform function must also be supplied.

drop = param.List(bounds=(0, None), default=[])

List of dimensions to drop when collating data, specified as strings.

drop_constant = param.Boolean(bounds=(0, 1), default=False)

Whether to demote any non-varying key dimensions to constant dimensions.

filters = param.List(bounds=(0, None), default=[])

List of paths to drop when collating data, specified as strings or tuples.

progress_bar = param.Parameter()

The progress bar instance used to report progress. Set to None to disable progress bars.

merge_type = param.ClassSelector(class_=<class ‘holoviews.core.ndmapping.NdMapping’>, default=<class ‘holoviews.core.spaces.HoloMap’>)

value_transform = param.Callable()

If supplied the function will be applied on each Collator value during collation. This may be used to apply an operation to the data or load references from disk before they are collated into a displayable HoloViews object.

add_dimension(dimension, dim_pos, dim_val, vdim=False, **kwargs)

Adds a dimension and its values to the object

Requires the dimension name or object, the desired position in the key dimensions and a key value scalar or sequence of the same length as the existing keys.

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

clone(data=None, shared_data=True, *args, **overrides)

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

property ddims

The list of deep dimensions

dframe()

Deprecated method to convert a MultiDimensionalMapping to a pandas DataFrame. Conversion to a dataframe now only supported by specific subclasses such as UniformNdMapping types.

dimension_values(dimension, expanded=True, flat=True)

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)

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

drop_dimension(dimensions)

Drops dimension(s) from keys

Args:

dimensions: Dimension(s) to drop

Returns:

Clone of object with with dropped dimension(s)

get(key, default=None)

Standard get semantics for all mapping types

get_dimension(dimension, default=None, strict=False)

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)

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)

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, container_type=None, group_type=None, **kwargs)

Groups object by one or more dimensions

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

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.

property info

Prints information about the Dimensioned object, including the number and type of objects contained within it and information about its dimensions.

items()

Returns all elements as a list in (key,value) format.

keys()

Returns the keys of all the elements.

property last

Returns the item highest data item along the map dimensions.

property last_key

Returns the last key value.

map(map_fn, specs=None, clone=True)

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)

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.

merge_type

alias of holoviews.core.spaces.HoloMap

options(*args, **kwargs)

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

pop(key, default=None)

Standard pop semantics for all mapping types

range(dimension, data_range=True, dimension_range=True)

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

reindex(kdims=[], force=False)

Reindexes object dropping static or supplied kdims

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

Reducing the number of key dimensions will discard information from the keys. All data values are accessible in the newly created object as the new labels must be sufficient to address each value uniquely.

Args:

kdims (optional): New list of key dimensions after reindexing force (bool, optional): Whether to drop non-unique items

Returns:

Reindexed object

relabel(label=None, group=None, depth=0)

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

select(selection_specs=None, **kwargs)

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

property static_dimensions

Return all constant dimensions.

table(datatype=None, **kwargs)

Deprecated method to convert an MultiDimensionalMapping of Elements to a Table.

traverse(fn=None, specs=None, full_breadth=True)

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

update(other)

Merges other item with this object

Args:
other: Object containing items to merge into this object

Must be a dictionary or NdMapping type

values()

Returns the values of all the elements.

holoviews.core.Columns

alias of holoviews.core.data.Dataset

class holoviews.core.CompositeOverlay(data, kdims=None, vdims=None, **params)[source]

Bases: holoviews.core.dimension.ViewableElement, holoviews.core.layout.Composable

CompositeOverlay provides a common baseclass for Overlay classes.

Parameters inherited from:

clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)

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

property ddims

The list of deep dimensions

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)

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)

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)

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)

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, index=0, **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 index (int, optional): Index of layer to apply hist to

Returns:

AdjointLayout of element and histogram or just the histogram

map(map_fn, specs=None, clone=True)

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)

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, **kwargs)

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)

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

relabel(label=None, group=None, depth=0)

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

select(selection_specs=None, **kwargs)

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)

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.core.Dataset(data=None, kdims=None, vdims=None, **kwargs)[source]

Bases: holoviews.core.element.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:

group = param.String(default=’Dataset’)

A string describing the data wrapped by the object.

datatype = param.List(bounds=(0, None), default=[‘dataframe’, ‘dictionary’, ‘grid’, ‘spatialpandas’, ‘xarray’, ‘cuDF’, ‘dask’, ‘array’, ‘multitabular’])

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(**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(**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)

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(**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

classmethod collapse_data(data, function=None, kdims=None, **kwargs)

Deprecated method to perform collapse operations, which may now be performed through concatenation and aggregation.

columns(**kwargs)[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

property dataset

The Dataset that this object was created from

property ddims

The list of deep dimensions

dframe(**kwargs)[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(**kwargs)[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)

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)

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)

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(**kwargs)[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(**kwargs)[source]

Groups object by one or more dimensions

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

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)

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(**kwargs)[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

mapping(kdims=None, vdims=None, **kwargs)

Deprecated method to convert data to dictionary

matches(spec)

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

Examples:

  • Index value in 2D array:

    dataset.ndloc[3, 1]

  • Slice along y-axis of 2D array:

    dataset.ndloc[2:5, :]

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

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

options(**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

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(**kwargs)[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(**kwargs)[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(**kwargs)[source]

Reindexes Dataset dropping static or supplied kdims

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

Args:

kdims (optional): New list of key dimensionsx vdims (optional): New list of value dimensions

Returns:

Reindexed object

relabel(**kwargs)[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(**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 nd-coordinates to sample bounds: Bounds of the region to sample

Defined as two-tuple for 1D sampling and four-tuple for 2D sampling.

closest: Whether to snap to closest coordinates **kwargs: Coordinates specified as keyword pairs

Keywords of dimensions and scalar coordinates

Returns:

Element containing the sampled coordinates

select(**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])

  • 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(**kwargs)[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

table(datatype=None)

Deprecated method to convert any Element to a Table.

property to

Returns the conversion interface with methods to convert Dataset

transform(**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)

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.core.Dimension(spec, **params)[source]

Bases: param.parameterized.Parameterized

Dimension objects are used to specify some important general features that may be associated with a collection of values.

For instance, a Dimension may specify that a set of numeric values actually correspond to ‘Height’ (dimension name), in units of meters, with a descriptive label ‘Height of adult males’.

All dimensions object have a name that identifies them and a label containing a suitable description. If the label is not explicitly specified it matches the name.

These two parameters define the core identity of the dimension object and must match if two dimension objects are to be considered equivalent. All other parameters are considered optional metadata and are not used when testing for equality.

Unlike all the other parameters, these core parameters can be used to construct a Dimension object from a tuple. This format is sufficient to define an identical Dimension:

Dimension(‘a’, label=’Dimension A’) == Dimension((‘a’, ‘Dimension A’))

Everything else about a dimension is considered to reflect non-semantic preferences. Examples include the default value (which may be used in a visualization to set an initial slider position), how the value is to rendered as text (which may be used to specify the printed floating point precision) or a suitable range of values to consider for a particular analysis.

Full unit support with automated conversions are on the HoloViews roadmap. Once rich unit objects are supported, the unit (or more specifically the type of unit) will be part of the core dimension specification used to establish equality.

Until this feature is implemented, there are two auxiliary parameters that hold some partial information about the unit: the name of the unit and whether or not it is cyclic. The name of the unit is used as part of the pretty-printed representation and knowing whether it is cyclic is important for certain operations.

label = param.String()

Unrestricted label used to describe the dimension. A label should succinctly describe the dimension and may contain any characters, including Unicode and LaTeX expression.

cyclic = param.Boolean(bounds=(0, 1), default=False)

Whether the range of this feature is cyclic such that the maximum allowed value (defined by the range parameter) is continuous with the minimum allowed value.

value_format = param.Callable()

Formatting function applied to each value before display.

range = param.Tuple(default=(None, None), length=2)

Specifies the minimum and maximum allowed values for a Dimension. None is used to represent an unlimited bound.

soft_range = param.Tuple(default=(None, None), length=2)

Specifies a minimum and maximum reference value, which may be overridden by the data.

type = param.Parameter()

Optional type associated with the Dimension values. The type may be an inbuilt constructor (such as int, str, float) or a custom class object.

default = param.Parameter()

Default value of the Dimension which may be useful for widget or other situations that require an initial or default value.

step = param.Number(inclusive_bounds=(True, True))

Optional floating point step specifying how frequently the underlying space should be sampled. May be used to define a discrete sampling over the range.

unit = param.String()

Optional unit string associated with the Dimension. For instance, the string ‘m’ may be used represent units of meters and ‘s’ to represent units of seconds.

values = param.List(bounds=(0, None), default=[])

Optional specification of the allowed value set for the dimension that may also be used to retain a categorical ordering.

clone(spec=None, **overrides)[source]

Clones the Dimension with new parameters

Derive a new Dimension that inherits existing parameters except for the supplied, explicit overrides

Args:

spec (tuple, optional): Dimension tuple specification **overrides: Dimension parameter overrides

Returns:

Cloned Dimension object

pprint()[source]

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

property pprint_label

The pretty-printed label string for the Dimension

pprint_value(value, print_unit=False)[source]

Applies the applicable formatter to the value.

Args:

value: Dimension value to format

Returns:

Formatted dimension value

pprint_value_string(value)[source]

Pretty print the dimension value and unit with title_format

Args:

value: Dimension value to format

Returns:

Formatted dimension value string with unit

property spec

“Returns the Dimensions tuple specification

Returns:

tuple: Dimension tuple specification

class holoviews.core.Dimensioned(data, kdims=None, vdims=None, **params)[source]

Bases: holoviews.core.dimension.LabelledData

Dimensioned is a base class that allows the data contents of a class to be associated with dimensions. The contents associated with dimensions may be partitioned into one of three types

  • key dimensions: These are the dimensions that can be indexed via

    the __getitem__ method. Dimension objects supporting key dimensions must support indexing over these dimensions and may also support slicing. This list ordering of dimensions describes the positional components of each multi-dimensional indexing operation.

    For instance, if the key dimension names are ‘weight’ followed by ‘height’ for Dimensioned object ‘obj’, then obj[80,175] indexes a weight of 80 and height of 175.

    Accessed using either kdims.

  • value dimensions: These dimensions correspond to any data held

    on the Dimensioned object not in the key dimensions. Indexing by value dimension is supported by dimension name (when there are multiple possible value dimensions); no slicing semantics is supported and all the data associated with that dimension will be returned at once. Note that it is not possible to mix value dimensions and deep dimensions.

    Accessed using either vdims.

  • deep dimensions: These are dynamically computed dimensions that

    belong to other Dimensioned objects that are nested in the data. Objects that support this should enable the _deep_indexable flag. Note that it is not possible to mix value dimensions and deep dimensions.

    Accessed using either ddims.

Dimensioned class support generalized methods for finding the range and type of values along a particular Dimension. The range method relies on the appropriate implementation of the dimension_values methods on subclasses.

The index of an arbitrary dimension is its positional index in the list of all dimensions, starting with the key dimensions, followed by the value dimensions and ending with the deep dimensions.

Parameters inherited from:

group = param.String(default=’Dimensioned’)

A string describing the data wrapped by the object.

cdims = param.Dict(class_=<class ‘dict’>, default=OrderedDict())

The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.

kdims = param.List(bounds=(0, None), default=[])

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

vdims = param.List(bounds=(0, None), default=[])

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

clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)

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

property ddims

The list of deep dimensions

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

map(map_fn, specs=None, clone=True)

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)

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, **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

relabel(label=None, group=None, depth=0)

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

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)

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.core.DynamicMap(callback, initial_items=None, streams=None, **params)[source]

Bases: holoviews.core.spaces.HoloMap

A DynamicMap is a type of HoloMap where the elements are dynamically generated by a callable. The callable is invoked with values associated with the key dimensions or with values supplied by stream parameters.

Parameters inherited from:

kdims = param.List(bounds=(0, None), default=[])

The key dimensions of a DynamicMap map to the arguments of the callback. This mapping can be by position or by name.

callback = param.ClassSelector(class_=<class ‘holoviews.core.spaces.Callable’>)

The callable used to generate the elements. The arguments to the callable includes any number of declared key dimensions as well as any number of stream parameters defined on the input streams. If the callable is an instance of Callable it will be used directly, otherwise it will be automatically wrapped in one.

streams = param.List(bounds=(0, None), default=[])

List of Stream instances to associate with the DynamicMap. The set of parameter values across these streams will be supplied as keyword arguments to the callback when the events are received, updating the streams.

cache_size = param.Integer(default=500, inclusive_bounds=(True, True))

The number of entries to cache for fast access. This is an LRU cache where the least recently used item is overwritten once the cache is full.

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

Adds a dimension and its values to the object

Requires the dimension name or object, the desired position in the key dimensions and a key value scalar or sequence of the same length as the existing keys.

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

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

collapse(dimensions=None, function=None, spreadfn=None, **kwargs)

Concatenates and aggregates along supplied dimensions

Useful to collapse stacks of objects into a single object, e.g. to average a stack of Images or Curves.

Args:
dimensions: Dimension(s) to collapse

Defaults to all key dimensions

function: Aggregation function to apply, e.g. numpy.mean spreadfn: Secondary reduction to compute value spread

Useful for computing a confidence interval, spread, or standard deviation.

**kwargs: Keyword arguments passed to the aggregation function

Returns:

Returns the collapsed element or HoloMap of collapsed elements

collate()[source]

Unpacks DynamicMap into container of DynamicMaps

Collation allows unpacking DynamicMaps which return Layout, NdLayout or GridSpace objects into a single such object containing DynamicMaps. Assumes that the items in the layout or grid that is returned do not change.

Returns:

Collated container containing DynamicMaps

property ddims

The list of deep dimensions

dframe(dimensions=None, multi_index=False)

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)

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)

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

drop_dimension(dimensions)[source]

Drops dimension(s) from keys

Args:

dimensions: Dimension(s) to drop

Returns:

Clone of object with with dropped dimension(s)

event(**kwargs)[source]

Updates attached streams and triggers events

Automatically find streams matching the supplied kwargs to update and trigger events on them.

Args:

**kwargs: Events to update streams with

get(key, default=None)

Standard get semantics for all mapping types

get_dimension(dimension, default=None, strict=False)

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)

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)

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

grid(dimensions=None, **kwargs)[source]

Groups data by supplied dimension(s) laying the groups along the dimension(s) out in a GridSpace.

Args: dimensions: Dimension/str or list

Dimension or list of dimensions to group by

Returns: grid: GridSpace

GridSpace with supplied dimensions

property group

Group inherited from items

groupby(dimensions=None, container_type=None, group_type=None, **kwargs)[source]

Groups DynamicMap by one or more dimensions

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

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 DynamicMap and adjoined histogram if adjoin=True, otherwise just the histogram

property info

Prints information about the Dimensioned object, including the number and type of objects contained within it and information about its dimensions.

items()

Returns all elements as a list in (key,value) format.

keys()

Returns the keys of all the elements.

property label

Label inherited from items

property last

Returns the item highest data item along the map dimensions.

property last_key

Returns the last key value.

layout(dimensions=None, **kwargs)[source]

Groups data by supplied dimension(s) laying the groups along the dimension(s) out in a NdLayout.

Args: dimensions: Dimension/str or list

Dimension or list of dimensions to group by

Returns: layout: NdLayout

NdLayout with supplied dimensions

map(map_fn, specs=None, clone=True, link_inputs=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)

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, **kwargs)[source]

Applies simplified option definition returning a new object.

Applies options defined in a flat format to the objects returned by the DynamicMap. If the options are to be set directly on the objects returned by the DynamicMap 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)})

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

overlay(dimensions=None, **kwargs)[source]

Group by supplied dimension(s) and overlay each group

Groups data by supplied dimension(s) overlaying the groups along the dimension(s).

Args:

dimensions: Dimension(s) of dimensions to group by

Returns:

NdOverlay object(s) with supplied dimensions

pop(key, default=None)

Standard pop semantics for all mapping types

range(dimension, data_range=True, dimension_range=True)

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, spread_fn=None, **reduce_map)

Applies reduction to elements 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=[], force=False)[source]

Reorders key dimensions on DynamicMap

Create a new object with a reordered set of key dimensions. Dropping dimensions is not allowed on a DynamicMap.

Args:

kdims: List of dimensions to reindex the mapping with force: Not applicable to a DynamicMap

Returns:

Reindexed DynamicMap

relabel(label=None, group=None, depth=1)[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

reset()[source]

Clear the DynamicMap cache

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

Samples element 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 nd-coordinates to sample bounds: Bounds of the region to sample

Defined as two-tuple for 1D sampling and four-tuple for 2D sampling.

closest: Whether to snap to closest coordinates **kwargs: Coordinates specified as keyword pairs

Keywords of dimensions and scalar coordinates

Returns:

A Table 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

split_overlays()[source]

Deprecated method to split overlays inside the DynamicMap.

table(datatype=None, **kwargs)

Deprecated method to convert an MultiDimensionalMapping of Elements to a Table.

traverse(fn=None, specs=None, full_breadth=True)

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

property type

The type of elements stored in the mapping.

property unbounded

Returns a list of key dimensions that are unbounded, excluding stream parameters. If any of theses key dimensions are unbounded, the DynamicMap as a whole is also unbounded.

update(other)

Merges other item with this object

Args:
other: Object containing items to merge into this object

Must be a dictionary or NdMapping type

values()

Returns the values of all the elements.

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

Bases: holoviews.core.dimension.ViewableElement, holoviews.core.layout.Composable, holoviews.core.overlay.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:

group = param.String(default=’Element’)

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)

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

classmethod collapse_data(data, function=None, kdims=None, **kwargs)[source]

Deprecated method to perform collapse operations, which may now be performed through concatenation and aggregation.

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)

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)

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)

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)

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)

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)

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

mapping(kdims=None, vdims=None, **kwargs)[source]

Deprecated method to convert data to dictionary

matches(spec)

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, **kwargs)

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)

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=[], 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)

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=[], 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 nd-coordinates to sample bounds: Bounds of the region to sample

Defined as two-tuple for 1D sampling and four-tuple for 2D sampling.

closest: Whether to snap to closest coordinates **kwargs: Coordinates specified as keyword pairs

Keywords of dimensions and scalar coordinates

Returns:

Element containing the sampled coordinates

select(selection_specs=None, **kwargs)

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

table(datatype=None)[source]

Deprecated method to convert any Element to a Table.

traverse(fn=None, specs=None, full_breadth=True)

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.core.Element2D(data, kdims=None, vdims=None, **params)[source]

Bases: holoviews.core.element.Element

Parameters inherited from:

extents = param.Tuple(default=(None, None, None, None), length=4)

Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.

array(dimensions=None)

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)

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)

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

classmethod collapse_data(data, function=None, kdims=None, **kwargs)

Deprecated method to perform collapse operations, which may now be performed through concatenation and aggregation.

property ddims

The list of deep dimensions

dframe(dimensions=None, multi_index=False)

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)

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)

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)

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)

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)

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)

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)

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

mapping(kdims=None, vdims=None, **kwargs)

Deprecated method to convert data to dictionary

matches(spec)

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, **kwargs)

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)

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=[], function=None, spreadfn=None, **reduction)

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)

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=[], bounds=None, closest=False, **sample_values)

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 nd-coordinates to sample bounds: Bounds of the region to sample

Defined as two-tuple for 1D sampling and four-tuple for 2D sampling.

closest: Whether to snap to closest coordinates **kwargs: Coordinates specified as keyword pairs

Keywords of dimensions and scalar coordinates

Returns:

Element containing the sampled coordinates

select(selection_specs=None, **kwargs)

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

table(datatype=None)

Deprecated method to convert any Element to a Table.

traverse(fn=None, specs=None, full_breadth=True)

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.core.Element3D(data, kdims=None, vdims=None, **params)[source]

Bases: holoviews.core.element.Element2D

Parameters inherited from:

extents = param.Tuple(default=(None, None, None, None, None, None), length=6)

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

array(dimensions=None)

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)

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)

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

classmethod collapse_data(data, function=None, kdims=None, **kwargs)

Deprecated method to perform collapse operations, which may now be performed through concatenation and aggregation.

property ddims

The list of deep dimensions

dframe(dimensions=None, multi_index=False)

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)

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)

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)

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)

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)

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)

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)

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

mapping(kdims=None, vdims=None, **kwargs)

Deprecated method to convert data to dictionary

matches(spec)

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, **kwargs)

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)

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=[], function=None, spreadfn=None, **reduction)

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)

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=[], bounds=None, closest=False, **sample_values)

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 nd-coordinates to sample bounds: Bounds of the region to sample

Defined as two-tuple for 1D sampling and four-tuple for 2D sampling.

closest: Whether to snap to closest coordinates **kwargs: Coordinates specified as keyword pairs

Keywords of dimensions and scalar coordinates

Returns:

Element containing the sampled coordinates

select(selection_specs=None, **kwargs)

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

table(datatype=None)

Deprecated method to convert any Element to a Table.

traverse(fn=None, specs=None, full_breadth=True)

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.core.Empty[source]

Bases: holoviews.core.dimension.Dimensioned, holoviews.core.layout.Composable

Empty may be used to define an empty placeholder in a Layout. It can be placed in a Layout just like any regular Element and container type via the + operator or by passing it to the Layout constructor as a part of a list.

Parameters inherited from:

group = param.String(default=’Empty’)

A string describing the data wrapped by the object.

clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)

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

property ddims

The list of deep dimensions

dimension_values(dimension, expanded=True, flat=True)

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)

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)

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)

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)

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

map(map_fn, specs=None, clone=True)

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)

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, **kwargs)

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)

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

relabel(label=None, group=None, depth=0)

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

select(selection_specs=None, **kwargs)

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)

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.core.GridMatrix(initial_items=None, kdims=None, **params)[source]

Bases: holoviews.core.spaces.GridSpace

GridMatrix is container type for heterogeneous Element types laid out in a grid. Unlike a GridSpace the axes of the Grid must not represent an actual coordinate space, but may be used to plot various dimensions against each other. The GridMatrix is usually constructed using the gridmatrix operation, which will generate a GridMatrix plotting each dimension in an Element against each other.

Parameters inherited from:

add_dimension(dimension, dim_pos, dim_val, vdim=False, **kwargs)

Adds a dimension and its values to the object

Requires the dimension name or object, the desired position in the key dimensions and a key value scalar or sequence of the same length as the existing keys.

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

clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)

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

collapse(dimensions=None, function=None, spreadfn=None, **kwargs)

Concatenates and aggregates along supplied dimensions

Useful to collapse stacks of objects into a single object, e.g. to average a stack of Images or Curves.

Args:
dimensions: Dimension(s) to collapse

Defaults to all key dimensions

function: Aggregation function to apply, e.g. numpy.mean spreadfn: Secondary reduction to compute value spread

Useful for computing a confidence interval, spread, or standard deviation.

**kwargs: Keyword arguments passed to the aggregation function

Returns:

Returns the collapsed element or HoloMap of collapsed elements

property ddims

The list of deep dimensions

dframe(dimensions=None, multi_index=False)

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)

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)

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

drop_dimension(dimensions)

Drops dimension(s) from keys

Args:

dimensions: Dimension(s) to drop

Returns:

Clone of object with with dropped dimension(s)

get(key, default=None)

Standard get semantics for all mapping types

get_dimension(dimension, default=None, strict=False)

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)

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)

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

property group

Group inherited from items

groupby(dimensions, container_type=None, group_type=None, **kwargs)

Groups object by one or more dimensions

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

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.

property info

Prints information about the Dimensioned object, including the number and type of objects contained within it and information about its dimensions.

items()

Returns all elements as a list in (key,value) format.

keys(full_grid=False)

Returns the keys of the GridSpace

Args:

full_grid (bool, optional): Return full cross-product of keys

Returns:

List of keys

property label

Label inherited from items

property last

The last of a GridSpace is another GridSpace constituted of the last of the individual elements. To access the elements by their X,Y position, either index the position directly or use the items() method.

property last_key

Returns the last key value.

map(map_fn, specs=None, clone=True)

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)

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, **kwargs)

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

pop(key, default=None)

Standard pop semantics for all mapping types

range(dimension, data_range=True, dimension_range=True)

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

reindex(kdims=[], force=False)

Reindexes object dropping static or supplied kdims

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

Reducing the number of key dimensions will discard information from the keys. All data values are accessible in the newly created object as the new labels must be sufficient to address each value uniquely.

Args:

kdims (optional): New list of key dimensions after reindexing force (bool, optional): Whether to drop non-unique items

Returns:

Reindexed object

relabel(label=None, group=None, depth=0)

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

select(selection_specs=None, **kwargs)

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

property shape

Returns the 2D shape of the GridSpace as (rows, cols).

table(datatype=None, **kwargs)

Deprecated method to convert an MultiDimensionalMapping of Elements to a Table.

traverse(fn=None, specs=None, full_breadth=True)

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

property type

The type of elements stored in the mapping.

update(other)

Merges other item with this object

Args:
other: Object containing items to merge into this object

Must be a dictionary or NdMapping type

values()

Returns the values of all the elements.

class holoviews.core.GridSpace(initial_items=None, kdims=None, **params)[source]

Bases: holoviews.core.ndmapping.UniformNdMapping

Grids are distinct from Layouts as they ensure all contained elements to be of the same type. Unlike Layouts, which have integer keys, Grids usually have floating point keys, which correspond to a grid sampling in some two-dimensional space. This two-dimensional space may have to arbitrary dimensions, e.g. for 2D parameter spaces.

Parameters inherited from:

kdims = param.List(bounds=(1, 2), default=[Dimension(‘X’), Dimension(‘Y’)])

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

add_dimension(dimension, dim_pos, dim_val, vdim=False, **kwargs)

Adds a dimension and its values to the object

Requires the dimension name or object, the desired position in the key dimensions and a key value scalar or sequence of the same length as the existing keys.

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

clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)

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

collapse(dimensions=None, function=None, spreadfn=None, **kwargs)

Concatenates and aggregates along supplied dimensions

Useful to collapse stacks of objects into a single object, e.g. to average a stack of Images or Curves.

Args:
dimensions: Dimension(s) to collapse

Defaults to all key dimensions

function: Aggregation function to apply, e.g. numpy.mean spreadfn: Secondary reduction to compute value spread

Useful for computing a confidence interval, spread, or standard deviation.

**kwargs: Keyword arguments passed to the aggregation function

Returns:

Returns the collapsed element or HoloMap of collapsed elements

property ddims

The list of deep dimensions

dframe(dimensions=None, multi_index=False)

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)

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)

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

drop_dimension(dimensions)

Drops dimension(s) from keys

Args:

dimensions: Dimension(s) to drop

Returns:

Clone of object with with dropped dimension(s)

get(key, default=None)

Standard get semantics for all mapping types

get_dimension(dimension, default=None, strict=False)

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)

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)

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

property group

Group inherited from items

groupby(dimensions, container_type=None, group_type=None, **kwargs)

Groups object by one or more dimensions

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

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.

property info

Prints information about the Dimensioned object, including the number and type of objects contained within it and information about its dimensions.

items()

Returns all elements as a list in (key,value) format.

keys(full_grid=False)[source]

Returns the keys of the GridSpace

Args:

full_grid (bool, optional): Return full cross-product of keys

Returns:

List of keys

property label

Label inherited from items

property last

The last of a GridSpace is another GridSpace constituted of the last of the individual elements. To access the elements by their X,Y position, either index the position directly or use the items() method.

property last_key

Returns the last key value.

map(map_fn, specs=None, clone=True)

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)

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, **kwargs)

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

pop(key, default=None)

Standard pop semantics for all mapping types

range(dimension, data_range=True, dimension_range=True)

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

reindex(kdims=[], force=False)

Reindexes object dropping static or supplied kdims

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

Reducing the number of key dimensions will discard information from the keys. All data values are accessible in the newly created object as the new labels must be sufficient to address each value uniquely.

Args:

kdims (optional): New list of key dimensions after reindexing force (bool, optional): Whether to drop non-unique items

Returns:

Reindexed object

relabel(label=None, group=None, depth=0)

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

select(selection_specs=None, **kwargs)

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

property shape

Returns the 2D shape of the GridSpace as (rows, cols).

table(datatype=None, **kwargs)

Deprecated method to convert an MultiDimensionalMapping of Elements to a Table.

traverse(fn=None, specs=None, full_breadth=True)

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

property type

The type of elements stored in the mapping.

update(other)

Merges other item with this object

Args:
other: Object containing items to merge into this object

Must be a dictionary or NdMapping type

values()

Returns the values of all the elements.

class holoviews.core.HoloMap(initial_items=None, kdims=None, group=None, label=None, **params)[source]

Bases: holoviews.core.ndmapping.UniformNdMapping, holoviews.core.overlay.Overlayable

A HoloMap is an n-dimensional mapping of viewable elements or overlays. Each item in a HoloMap has an tuple key defining the values along each of the declared key dimensions, defining the discretely sampled space of values.

The visual representation of a HoloMap consists of the viewable objects inside the HoloMap which can be explored by varying one or more widgets mapping onto the key dimensions of the HoloMap.

Parameters inherited from:

add_dimension(dimension, dim_pos, dim_val, vdim=False, **kwargs)

Adds a dimension and its values to the object

Requires the dimension name or object, the desired position in the key dimensions and a key value scalar or sequence of the same length as the existing keys.

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

clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)

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

collapse(dimensions=None, function=None, spreadfn=None, **kwargs)

Concatenates and aggregates along supplied dimensions

Useful to collapse stacks of objects into a single object, e.g. to average a stack of Images or Curves.

Args:
dimensions: Dimension(s) to collapse

Defaults to all key dimensions

function: Aggregation function to apply, e.g. numpy.mean spreadfn: Secondary reduction to compute value spread

Useful for computing a confidence interval, spread, or standard deviation.

**kwargs: Keyword arguments passed to the aggregation function

Returns:

Returns the collapsed element or HoloMap of collapsed elements

collate(merge_type=None, drop=[], drop_constant=False)[source]

Collate allows reordering nested containers

Collation allows collapsing nested mapping types by merging their dimensions. In simple terms in merges nested containers into a single merged type.

In the simple case a HoloMap containing other HoloMaps can easily be joined in this way. However collation is particularly useful when the objects being joined are deeply nested, e.g. you want to join multiple Layouts recorded at different times, collation will return one Layout containing HoloMaps indexed by Time. Changing the merge_type will allow merging the outer Dimension into any other UniformNdMapping type.

Args:

merge_type: Type of the object to merge with drop: List of dimensions to drop drop_constant: Drop constant dimensions automatically

Returns:

Collated Layout or HoloMap

property ddims

The list of deep dimensions

dframe(dimensions=None, multi_index=False)

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)

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)

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

drop_dimension(dimensions)

Drops dimension(s) from keys

Args:

dimensions: Dimension(s) to drop

Returns:

Clone of object with with dropped dimension(s)

get(key, default=None)

Standard get semantics for all mapping types

get_dimension(dimension, default=None, strict=False)

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)

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)

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

grid(dimensions=None, **kwargs)[source]

Group by supplied dimension(s) and lay out groups in grid

Groups data by supplied dimension(s) laying the groups along the dimension(s) out in a GridSpace.

Args: dimensions: Dimension/str or list

Dimension or list of dimensions to group by

Returns:

GridSpace with supplied dimensions

property group

Group inherited from items

groupby(dimensions, container_type=None, group_type=None, **kwargs)

Groups object by one or more dimensions

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

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, individually=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 HoloMap and histograms or just the histograms

property info

Prints information about the Dimensioned object, including the number and type of objects contained within it and information about its dimensions.

items()

Returns all elements as a list in (key,value) format.

keys()

Returns the keys of all the elements.

property label

Label inherited from items

property last

Returns the item highest data item along the map dimensions.

property last_key

Returns the last key value.

layout(dimensions=None, **kwargs)[source]

Group by supplied dimension(s) and lay out groups

Groups data by supplied dimension(s) laying the groups along the dimension(s) out in a NdLayout.

Args:

dimensions: Dimension(s) to group by

Returns:

NdLayout with supplied dimensions

map(map_fn, specs=None, clone=True)

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)

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, **kwargs)[source]

Applies simplified option definition returning a new object

Applies options defined in a flat format to the objects returned by the DynamicMap. If the options are to be set directly on the objects in the HoloMap 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)})

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

overlay(dimensions=None, **kwargs)[source]

Group by supplied dimension(s) and overlay each group

Groups data by supplied dimension(s) overlaying the groups along the dimension(s).

Args:

dimensions: Dimension(s) of dimensions to group by

Returns:

NdOverlay object(s) with supplied dimensions

pop(key, default=None)

Standard pop semantics for all mapping types

range(dimension, data_range=True, dimension_range=True)

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, spread_fn=None, **reduce_map)[source]

Applies reduction to elements 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=[], force=False)

Reindexes object dropping static or supplied kdims

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

Reducing the number of key dimensions will discard information from the keys. All data values are accessible in the newly created object as the new labels must be sufficient to address each value uniquely.

Args:

kdims (optional): New list of key dimensions after reindexing force (bool, optional): Whether to drop non-unique items

Returns:

Reindexed object

relabel(label=None, group=None, depth=1)[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=[], bounds=None, **sample_values)[source]

Samples element 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 nd-coordinates to sample bounds: Bounds of the region to sample

Defined as two-tuple for 1D sampling and four-tuple for 2D sampling.

closest: Whether to snap to closest coordinates **kwargs: Coordinates specified as keyword pairs

Keywords of dimensions and scalar coordinates

Returns:

A Table containing the sampled coordinates

select(selection_specs=None, **kwargs)

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

split_overlays()[source]

Deprecated method to split overlays inside the HoloMap.

table(datatype=None, **kwargs)

Deprecated method to convert an MultiDimensionalMapping of Elements to a Table.

traverse(fn=None, specs=None, full_breadth=True)

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

property type

The type of elements stored in the mapping.

update(other)

Merges other item with this object

Args:
other: Object containing items to merge into this object

Must be a dictionary or NdMapping type

values()

Returns the values of all the elements.

class holoviews.core.Layout(items=None, identifier=None, parent=None, **kwargs)[source]

Bases: holoviews.core.dimension.ViewableTree

A Layout is an ViewableTree with ViewableElement objects as leaf values. Unlike ViewableTree, a Layout supports a rich display, displaying leaf items in a grid style layout. In addition to the usual ViewableTree indexing, Layout supports indexing of items by their row and column index in the layout.

The maximum number of columns in such a layout may be controlled with the cols method.

Parameters inherited from:

group = param.String(default=’Layout’)

A string describing the data wrapped by the object.

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

Clones the Layout, 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 *args: Additional arguments to pass to constructor **overrides: New keyword arguments to pass to constructor

Returns:

Cloned Layout object

cols(ncols)[source]

Sets the maximum number of columns in the NdLayout.

Any items beyond the set number of cols will flow onto a new row. The number of columns control the indexing and display semantics of the NdLayout.

Args:

ncols (int): Number of columns to set on the NdLayout

property ddims

The list of deep dimensions

dimension_values(dimension, expanded=True, flat=True)

Return the values along the requested dimension.

Concatenates values on all nodes with 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)

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

filter(path_filters)

Filters the loaded AttrTree using the supplied path_filters.

property fixed

If fixed, no new paths can be created via attribute access

classmethod from_values(vals)

Deprecated method to construct tree from list of objects

get(identifier, default=None)

Get a node of the AttrTree using its path string.

Args:

identifier: Path string of the node to return default: Value to return if no node is found

Returns:

The indexed node of the AttrTree

get_dimension(dimension, default=None, strict=False)

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)

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)

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

items()

Keys and nodes of the AttrTree

keys()

Keys of nodes in the AttrTree

map(map_fn, specs=None, clone=True)

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)

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.

classmethod merge(trees)

Merge a collection of AttrTree objects.

options(*args, **kwargs)

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

property path

Returns the path up to the root for the current node.

pop(identifier, default=None)

Pop a node of the AttrTree using its path string.

Args:

identifier: Path string of the node to return default: Value to return if no node is found

Returns:

The node that was removed from the AttrTree

range(dimension, data_range=True, dimension_range=True)

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

relabel(label=None, group=None, depth=1)[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

select(selection_specs=None, **kwargs)

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

set_path(path, val)

Set the given value at the supplied path where path is either a tuple of strings or a string in A.B.C format.

property shape

Tuple indicating the number of rows and columns in the Layout.

traverse(fn=None, specs=None, full_breadth=True)

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

property uniform

Whether items in tree have uniform dimensions

update(other)

Updated the contents of the current AttrTree with the contents of a second AttrTree.

values()

Nodes of the AttrTree

class holoviews.core.MultiDimensionalMapping(initial_items=None, kdims=None, **params)[source]

Bases: holoviews.core.dimension.Dimensioned

An MultiDimensionalMapping is a Dimensioned mapping (like a dictionary or array) that uses fixed-length multidimensional keys. This behaves like a sparse N-dimensional array that does not require a dense sampling over the multidimensional space.

If the underlying value for each (key, value) pair also supports indexing (such as a dictionary, array, or list), fully qualified (deep) indexing may be used from the top level, with the first N dimensions of the index selecting a particular Dimensioned object and the remaining dimensions indexing into that object.

For instance, for a MultiDimensionalMapping with dimensions “Year” and “Month” and underlying values that are 2D floating-point arrays indexed by (r,c), a 2D array may be indexed with x[2000,3] and a single floating-point number may be indexed as x[2000,3,1,9].

In practice, this class is typically only used as an abstract base class, because the NdMapping subclass extends it with a range of useful slicing methods for selecting subsets of the data. Even so, keeping the slicing support separate from the indexing and data storage methods helps make both classes easier to understand.

Parameters inherited from:

group = param.String(default=’MultiDimensionalMapping’)

A string describing the data wrapped by the object.

kdims = param.List(bounds=(0, None), default=[Dimension(‘Default’)])

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

vdims = param.List(bounds=(0, 0), default=[])

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.

sort = param.Boolean(bounds=(0, 1), default=True)

Whether the items should be sorted in the constructor.

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

Adds a dimension and its values to the object

Requires the dimension name or object, the desired position in the key dimensions and a key value scalar or sequence of the same length as the existing keys.

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

clone(data=None, shared_data=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

property ddims

The list of deep dimensions

dframe()[source]

Deprecated method to convert a MultiDimensionalMapping to a pandas DataFrame. Conversion to a dataframe now only supported by specific subclasses such as UniformNdMapping types.

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)

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

drop_dimension(dimensions)[source]

Drops dimension(s) from keys

Args:

dimensions: Dimension(s) to drop

Returns:

Clone of object with with dropped dimension(s)

get(key, default=None)[source]

Standard get semantics for all mapping types

get_dimension(dimension, default=None, strict=False)

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)

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)

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, container_type=None, group_type=None, **kwargs)[source]

Groups object by one or more dimensions

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

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.

property info

Prints information about the Dimensioned object, including the number and type of objects contained within it and information about its dimensions.

items()[source]

Returns all elements as a list in (key,value) format.

keys()[source]

Returns the keys of all the elements.

property last

Returns the item highest data item along the map dimensions.

property last_key

Returns the last key value.

map(map_fn, specs=None, clone=True)

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)

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, **kwargs)

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

pop(key, default=None)[source]

Standard pop semantics for all mapping types

range(dimension, data_range=True, dimension_range=True)

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

reindex(kdims=[], force=False)[source]

Reindexes object dropping static or supplied kdims

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

Reducing the number of key dimensions will discard information from the keys. All data values are accessible in the newly created object as the new labels must be sufficient to address each value uniquely.

Args:

kdims (optional): New list of key dimensions after reindexing force (bool, optional): Whether to drop non-unique items

Returns:

Reindexed object

relabel(label=None, group=None, depth=0)

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

select(selection_specs=None, **kwargs)

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

table(datatype=None, **kwargs)[source]

Deprecated method to convert an MultiDimensionalMapping of Elements to a Table.

traverse(fn=None, specs=None, full_breadth=True)

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

update(other)[source]

Merges other item with this object

Args:
other: Object containing items to merge into this object

Must be a dictionary or NdMapping type

values()[source]

Returns the values of all the elements.

class holoviews.core.NdLayout(initial_items=None, kdims=None, **params)[source]

Bases: holoviews.core.ndmapping.UniformNdMapping

NdLayout is a UniformNdMapping providing an n-dimensional data structure to display the contained Elements and containers in a layout. Using the cols method the NdLayout can be rearranged with the desired number of columns.

Parameters inherited from:

add_dimension(dimension, dim_pos, dim_val, vdim=False, **kwargs)

Adds a dimension and its values to the object

Requires the dimension name or object, the desired position in the key dimensions and a key value scalar or sequence of the same length as the existing keys.

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

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

Clones the NdLayout, 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 *args: Additional arguments to pass to constructor **overrides: New keyword arguments to pass to constructor

Returns:

Cloned NdLayout object

collapse(dimensions=None, function=None, spreadfn=None, **kwargs)

Concatenates and aggregates along supplied dimensions

Useful to collapse stacks of objects into a single object, e.g. to average a stack of Images or Curves.

Args:
dimensions: Dimension(s) to collapse

Defaults to all key dimensions

function: Aggregation function to apply, e.g. numpy.mean spreadfn: Secondary reduction to compute value spread

Useful for computing a confidence interval, spread, or standard deviation.

**kwargs: Keyword arguments passed to the aggregation function

Returns:

Returns the collapsed element or HoloMap of collapsed elements

cols(ncols)[source]

Sets the maximum number of columns in the NdLayout.

Any items beyond the set number of cols will flow onto a new row. The number of columns control the indexing and display semantics of the NdLayout.

Args:

ncols (int): Number of columns to set on the NdLayout

property ddims

The list of deep dimensions

dframe(dimensions=None, multi_index=False)

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)

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)

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

drop_dimension(dimensions)

Drops dimension(s) from keys

Args:

dimensions: Dimension(s) to drop

Returns:

Clone of object with with dropped dimension(s)

get(key, default=None)

Standard get semantics for all mapping types

get_dimension(dimension, default=None, strict=False)

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)

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)

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

grid_items()[source]

Compute a dict of {(row,column): (key, value)} elements from the current set of items and specified number of columns.

property group

Group inherited from items

groupby(dimensions, container_type=None, group_type=None, **kwargs)

Groups object by one or more dimensions

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

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.

property info

Prints information about the Dimensioned object, including the number and type of objects contained within it and information about its dimensions.

items()

Returns all elements as a list in (key,value) format.

keys()

Returns the keys of all the elements.

property label

Label inherited from items

property last

Returns another NdLayout constituted of the last views of the individual elements (if they are maps).

property last_key

Returns the last key value.

map(map_fn, specs=None, clone=True)

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)

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, **kwargs)

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

pop(key, default=None)

Standard pop semantics for all mapping types

range(dimension, data_range=True, dimension_range=True)

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

reindex(kdims=[], force=False)

Reindexes object dropping static or supplied kdims

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

Reducing the number of key dimensions will discard information from the keys. All data values are accessible in the newly created object as the new labels must be sufficient to address each value uniquely.

Args:

kdims (optional): New list of key dimensions after reindexing force (bool, optional): Whether to drop non-unique items

Returns:

Reindexed object

relabel(label=None, group=None, depth=0)

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

select(selection_specs=None, **kwargs)

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

property shape

Tuple indicating the number of rows and columns in the NdLayout.

table(datatype=None, **kwargs)

Deprecated method to convert an MultiDimensionalMapping of Elements to a Table.

traverse(fn=None, specs=None, full_breadth=True)

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

property type

The type of elements stored in the mapping.

update(other)

Merges other item with this object

Args:
other: Object containing items to merge into this object

Must be a dictionary or NdMapping type

values()

Returns the values of all the elements.

class holoviews.core.NdMapping(initial_items=None, kdims=None, **params)[source]

Bases: holoviews.core.ndmapping.MultiDimensionalMapping

NdMapping supports the same indexing semantics as MultiDimensionalMapping but also supports slicing semantics.

Slicing semantics on an NdMapping is dependent on the ordering semantics of the keys. As MultiDimensionalMapping sort the keys, a slice on an NdMapping is effectively a way of filtering out the keys that are outside the slice range.

Parameters inherited from:

group = param.String(default=’NdMapping’)

A string describing the data wrapped by the object.

add_dimension(dimension, dim_pos, dim_val, vdim=False, **kwargs)

Adds a dimension and its values to the object

Requires the dimension name or object, the desired position in the key dimensions and a key value scalar or sequence of the same length as the existing keys.

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

clone(data=None, shared_data=True, *args, **overrides)

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

property ddims

The list of deep dimensions

dframe()

Deprecated method to convert a MultiDimensionalMapping to a pandas DataFrame. Conversion to a dataframe now only supported by specific subclasses such as UniformNdMapping types.

dimension_values(dimension, expanded=True, flat=True)

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)

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

drop_dimension(dimensions)

Drops dimension(s) from keys

Args:

dimensions: Dimension(s) to drop

Returns:

Clone of object with with dropped dimension(s)

get(key, default=None)

Standard get semantics for all mapping types

get_dimension(dimension, default=None, strict=False)

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)

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)

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, container_type=None, group_type=None, **kwargs)

Groups object by one or more dimensions

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

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.

property info

Prints information about the Dimensioned object, including the number and type of objects contained within it and information about its dimensions.

items()

Returns all elements as a list in (key,value) format.

keys()

Returns the keys of all the elements.

property last

Returns the item highest data item along the map dimensions.

property last_key

Returns the last key value.

map(map_fn, specs=None, clone=True)

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)

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, **kwargs)

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

pop(key, default=None)

Standard pop semantics for all mapping types

range(dimension, data_range=True, dimension_range=True)

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

reindex(kdims=[], force=False)

Reindexes object dropping static or supplied kdims

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

Reducing the number of key dimensions will discard information from the keys. All data values are accessible in the newly created object as the new labels must be sufficient to address each value uniquely.

Args:

kdims (optional): New list of key dimensions after reindexing force (bool, optional): Whether to drop non-unique items

Returns:

Reindexed object

relabel(label=None, group=None, depth=0)

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

select(selection_specs=None, **kwargs)

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

table(datatype=None, **kwargs)

Deprecated method to convert an MultiDimensionalMapping of Elements to a Table.

traverse(fn=None, specs=None, full_breadth=True)

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

update(other)

Merges other item with this object

Args:
other: Object containing items to merge into this object

Must be a dictionary or NdMapping type

values()

Returns the values of all the elements.

class holoviews.core.NdOverlay(overlays=None, kdims=None, **params)[source]

Bases: holoviews.core.overlay.Overlayable, holoviews.core.ndmapping.UniformNdMapping, holoviews.core.overlay.CompositeOverlay

An NdOverlay allows a group of NdOverlay to be overlaid together. NdOverlay can be indexed out of an overlay and an overlay is an iterable that iterates over the contained layers.

Parameters inherited from:

kdims = param.List(bounds=(0, None), default=[Dimension(‘Element’)])

List of dimensions the NdOverlay can be indexed by.

add_dimension(dimension, dim_pos, dim_val, vdim=False, **kwargs)

Adds a dimension and its values to the object

Requires the dimension name or object, the desired position in the key dimensions and a key value scalar or sequence of the same length as the existing keys.

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

clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)

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

collapse(dimensions=None, function=None, spreadfn=None, **kwargs)

Concatenates and aggregates along supplied dimensions

Useful to collapse stacks of objects into a single object, e.g. to average a stack of Images or Curves.

Args:
dimensions: Dimension(s) to collapse

Defaults to all key dimensions

function: Aggregation function to apply, e.g. numpy.mean spreadfn: Secondary reduction to compute value spread

Useful for computing a confidence interval, spread, or standard deviation.

**kwargs: Keyword arguments passed to the aggregation function

Returns:

Returns the collapsed element or HoloMap of collapsed elements

property ddims

The list of deep dimensions

dframe(dimensions=None, multi_index=False)

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)

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)

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

drop_dimension(dimensions)

Drops dimension(s) from keys

Args:

dimensions: Dimension(s) to drop

Returns:

Clone of object with with dropped dimension(s)

get(key, default=None)

Standard get semantics for all mapping types

get_dimension(dimension, default=None, strict=False)

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)

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)

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

property group

Group inherited from items

groupby(dimensions, container_type=None, group_type=None, **kwargs)

Groups object by one or more dimensions

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

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, index=0, **kwargs)

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 index (int, optional): Index of layer to apply hist to

Returns:

AdjointLayout of element and histogram or just the histogram

property info

Prints information about the Dimensioned object, including the number and type of objects contained within it and information about its dimensions.

items()

Returns all elements as a list in (key,value) format.

keys()

Returns the keys of all the elements.

property label

Label inherited from items

property last

Returns the item highest data item along the map dimensions.

property last_key

Returns the last key value.

map(map_fn, specs=None, clone=True)

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)

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, **kwargs)

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

pop(key, default=None)

Standard pop semantics for all mapping types

range(dimension, data_range=True, dimension_range=True)

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

reindex(kdims=[], force=False)

Reindexes object dropping static or supplied kdims

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

Reducing the number of key dimensions will discard information from the keys. All data values are accessible in the newly created object as the new labels must be sufficient to address each value uniquely.

Args:

kdims (optional): New list of key dimensions after reindexing force (bool, optional): Whether to drop non-unique items

Returns:

Reindexed object

relabel(label=None, group=None, depth=0)

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

select(selection_specs=None, **kwargs)

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

table(datatype=None, **kwargs)

Deprecated method to convert an MultiDimensionalMapping of Elements to a Table.

traverse(fn=None, specs=None, full_breadth=True)

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

property type

The type of elements stored in the mapping.

update(other)

Merges other item with this object

Args:
other: Object containing items to merge into this object

Must be a dictionary or NdMapping type

values()

Returns the values of all the elements.

class holoviews.core.Operation(*args, **params)[source]

Bases: param.parameterized.ParameterizedFunction

An Operation process an Element or HoloMap at the level of individual elements or overlays. If a holomap is passed in as input, a processed holomap is returned as output where the individual elements have been transformed accordingly. An Operation may turn overlays in new elements or vice versa.

An Operation can be set to be dynamic, which will return a DynamicMap with a callback that will apply the operation dynamically. An Operation may also supply a list of Stream classes on a streams parameter, which can allow dynamic control over the parameters on the operation.

group = param.String(default=’Operation’)

The group string used to identify the output of the Operation. By default this should match the operation name.

dynamic = param.ObjectSelector(default=’default’, objects=[‘default’, True, False])

Whether the operation should be applied dynamically when a specific frame is requested, specified as a Boolean. If set to ‘default’ the mode will be determined based on the input type, i.e. if the data is a DynamicMap it will stay dynamic.

input_ranges = param.ClassSelector(class_=(<class ‘dict’>, <class ‘tuple’>), default={})

Ranges to be used for input normalization (if applicable) in a format appropriate for the Normalization.ranges parameter. By default, no normalization is applied. If key-wise normalization is required, a 2-tuple may be supplied where the first component is a Normalization.ranges list and the second component is Normalization.keys.

link_inputs = param.Boolean(bounds=(0, 1), default=False)

If the operation is dynamic, whether or not linked streams should be transferred from the operation inputs for backends that support linked streams. For example if an operation is applied to a DynamicMap with an RangeXY, this switch determines whether the corresponding visualization should update this stream with range changes originating from the newly generated axes.

streams = param.List(bounds=(0, None), default=[])

List of streams that are applied if dynamic=True, allowing for dynamic interaction with the plot.

classmethod get_overlay_bounds(overlay)[source]

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

instance(**params)

Return an instance of this class, copying parameters from any existing instance provided.

pprint(imports=None, prefix='\n ', unknown_value='<?>', qualify=False, separator='')

Same as Parameterized.pprint, except that X.classname(Y is replaced with X.classname.instance(Y

process_element(element, key, **params)[source]

The process_element method allows a single element to be operated on given an externally supplied key.

script_repr(imports=[], prefix=' ')

Same as Parameterized.script_repr, except that X.classname(Y is replaced with X.classname.instance(Y

classmethod search(element, pattern)[source]

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

class holoviews.core.Overlay(items=None, group=None, label=None, **params)[source]

Bases: holoviews.core.dimension.ViewableTree, holoviews.core.overlay.CompositeOverlay

An Overlay consists of multiple Elements (potentially of heterogeneous type) presented one on top each other with a particular z-ordering.

Overlays along with elements constitute the only valid leaf types of a Layout and in fact extend the Layout structure. Overlays are constructed using the * operator (building an identical structure to the + operator).

Parameters inherited from:

clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)

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

collapse(function)[source]

Deprecated method to collapse layers in the Overlay.

collate()[source]

Collates any objects in the Overlay resolving any issues the recommended nesting structure.

property ddims

The list of deep dimensions

dimension_values(dimension, expanded=True, flat=True)

Return the values along the requested dimension.

Concatenates values on all nodes with 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)

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

filter(path_filters)

Filters the loaded AttrTree using the supplied path_filters.

property fixed

If fixed, no new paths can be created via attribute access

classmethod from_values(vals)

Deprecated method to construct tree from list of objects

get(identifier, default=None)[source]

Get a layer in the Overlay.

Get a particular layer in the Overlay using its path string or an integer index.

Args:

identifier: Index or path string of the item to return default: Value to return if no item is found

Returns:

The indexed layer of the Overlay

get_dimension(dimension, default=None, strict=False)

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)

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)

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

property group

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

hist(dimension=None, num_bins=20, bin_range=None, adjoin=True, index=0, **kwargs)

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 index (int, optional): Index of layer to apply hist to

Returns:

AdjointLayout of element and histogram or just the histogram

items()

Keys and nodes of the AttrTree

keys()

Keys of nodes in the AttrTree

property label

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

map(map_fn, specs=None, clone=True)

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)

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.

classmethod merge(trees)

Merge a collection of AttrTree objects.

options(*args, **kwargs)

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

property path

Returns the path up to the root for the current node.

pop(identifier, default=None)

Pop a node of the AttrTree using its path string.

Args:

identifier: Path string of the node to return default: Value to return if no node is found

Returns:

The node that was removed from the AttrTree

range(dimension, data_range=True, dimension_range=True)

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

relabel(label=None, group=None, depth=0)

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

select(selection_specs=None, **kwargs)

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

set_path(path, val)

Set the given value at the supplied path where path is either a tuple of strings or a string in A.B.C format.

traverse(fn=None, specs=None, full_breadth=True)

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

property uniform

Whether items in tree have uniform dimensions

update(other)

Updated the contents of the current AttrTree with the contents of a second AttrTree.

values()

Nodes of the AttrTree

class holoviews.core.SheetCoordinateSystem(bounds, xdensity, ydensity=None)[source]

Bases: object

Provides methods to allow conversion between sheet and matrix coordinates.

closest_cell_center(x, y)[source]

Given arbitrary sheet coordinates, return the sheet coordinates of the center of the closest unit.

matrix2sheet(float_row, float_col)[source]

Convert a floating-point location (float_row,float_col) in matrix coordinates to its corresponding location (x,y) in sheet coordinates.

Valid for scalar or array float_row and float_col.

Inverse of sheet2matrix().

matrixidx2sheet(row, col)[source]

Return (x,y) where x and y are the floating point coordinates of the center of the given matrix cell (row,col). If the matrix cell represents a 0.2 by 0.2 region, then the center location returned would be 0.1,0.1.

NOTE: This is NOT the strict mathematical inverse of sheet2matrixidx(), because sheet2matrixidx() discards all but the integer portion of the continuous matrix coordinate.

Valid only for scalar or array row and col.

sheet2matrix(x, y)[source]

Convert a point (x,y) in Sheet coordinates to continuous matrix coordinates.

Returns (float_row,float_col), where float_row corresponds to y, and float_col to x.

Valid for scalar or array x and y.

Note about Bounds For a Sheet with BoundingBox(points=((-0.5,-0.5),(0.5,0.5))) and density=3, x=-0.5 corresponds to float_col=0.0 and x=0.5 corresponds to float_col=3.0. float_col=3.0 is not inside the matrix representing this Sheet, which has the three columns (0,1,2). That is, x=-0.5 is inside the BoundingBox but x=0.5 is outside. Similarly, y=0.5 is inside (at row 0) but y=-0.5 is outside (at row 3) (it’s the other way round for y because the matrix row index increases as y decreases).

sheet2matrixidx(x, y)[source]

Convert a point (x,y) in sheet coordinates to the integer row and column index of the matrix cell in which that point falls, given a bounds and density. Returns (row,column).

Note that if coordinates along the right or bottom boundary are passed into this function, the returned matrix coordinate of the boundary will be just outside the matrix, because the right and bottom boundaries are exclusive.

Valid for scalar or array x and y.

sheetcoordinates_of_matrixidx()[source]

Return x,y where x is a vector of sheet coordinates representing the x-center of each matrix cell, and y represents the corresponding y-center of the cell.

property xdensity

The spacing between elements in an underlying matrix representation, in the x direction.

property ydensity

The spacing between elements in an underlying matrix representation, in the y direction.

class holoviews.core.Tabular(data, kdims=None, vdims=None, **params)[source]

Bases: holoviews.core.element.Element

Baseclass to give an elements providing an API to generate a tabular representation of the object.

Parameters inherited from:

array(dimensions=None)

Convert dimension values to columnar array.

Args:

dimensions: List of dimensions to return

Returns:

Array of columns corresponding to each dimension

cell_type(row, col)[source]

Type of the table cell, either ‘data’ or ‘heading’

Args:

row (int): Integer index of table row col (int): Integer index of table column

Returns:

Type of the table cell, either ‘data’ or ‘heading’

clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)

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)

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

classmethod collapse_data(data, function=None, kdims=None, **kwargs)

Deprecated method to perform collapse operations, which may now be performed through concatenation and aggregation.

property cols

Number of columns in table

property ddims

The list of deep dimensions

dframe(dimensions=None, multi_index=False)

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)

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)

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)

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)

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)

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)

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)

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

mapping(kdims=None, vdims=None, **kwargs)

Deprecated method to convert data to dictionary

matches(spec)

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, **kwargs)

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

pprint_cell(row, col)[source]

Formatted contents of table cell.

Args:

row (int): Integer index of table row col (int): Integer index of table column

Returns:

Formatted table cell contents

range(dimension, data_range=True, dimension_range=True)

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=[], function=None, spreadfn=None, **reduction)

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)

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

property rows

Number of rows in table (including header)

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

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 nd-coordinates to sample bounds: Bounds of the region to sample

Defined as two-tuple for 1D sampling and four-tuple for 2D sampling.

closest: Whether to snap to closest coordinates **kwargs: Coordinates specified as keyword pairs

Keywords of dimensions and scalar coordinates

Returns:

Element containing the sampled coordinates

select(selection_specs=None, **kwargs)

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

table(datatype=None)

Deprecated method to convert any Element to a Table.

traverse(fn=None, specs=None, full_breadth=True)

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.core.UniformNdMapping(initial_items=None, kdims=None, group=None, label=None, **params)[source]

Bases: holoviews.core.ndmapping.NdMapping

A UniformNdMapping is a map of Dimensioned objects and is itself indexed over a number of specified dimensions. The dimension may be a spatial dimension (i.e., a ZStack), time (specifying a frame sequence) or any other combination of Dimensions.

UniformNdMapping objects can be sliced, sampled, reduced, overlaid and split along its and its containing Element’s dimensions. Subclasses should implement the appropriate slicing, sampling and reduction methods for their Dimensioned type.

Parameters inherited from:

add_dimension(dimension, dim_pos, dim_val, vdim=False, **kwargs)

Adds a dimension and its values to the object

Requires the dimension name or object, the desired position in the key dimensions and a key value scalar or sequence of the same length as the existing keys.

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

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

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

Concatenates and aggregates along supplied dimensions

Useful to collapse stacks of objects into a single object, e.g. to average a stack of Images or Curves.

Args:
dimensions: Dimension(s) to collapse

Defaults to all key dimensions

function: Aggregation function to apply, e.g. numpy.mean spreadfn: Secondary reduction to compute value spread

Useful for computing a confidence interval, spread, or standard deviation.

**kwargs: Keyword arguments passed to the aggregation function

Returns:

Returns the collapsed element or HoloMap of collapsed elements

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)

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)

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

drop_dimension(dimensions)

Drops dimension(s) from keys

Args:

dimensions: Dimension(s) to drop

Returns:

Clone of object with with dropped dimension(s)

get(key, default=None)

Standard get semantics for all mapping types

get_dimension(dimension, default=None, strict=False)

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)

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)

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

property group

Group inherited from items

groupby(dimensions, container_type=None, group_type=None, **kwargs)

Groups object by one or more dimensions

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

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.

property info

Prints information about the Dimensioned object, including the number and type of objects contained within it and information about its dimensions.

items()

Returns all elements as a list in (key,value) format.

keys()

Returns the keys of all the elements.

property label

Label inherited from items

property last

Returns the item highest data item along the map dimensions.

property last_key

Returns the last key value.

map(map_fn, specs=None, clone=True)

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)

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, **kwargs)

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

pop(key, default=None)

Standard pop semantics for all mapping types

range(dimension, data_range=True, dimension_range=True)

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

reindex(kdims=[], force=False)

Reindexes object dropping static or supplied kdims

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

Reducing the number of key dimensions will discard information from the keys. All data values are accessible in the newly created object as the new labels must be sufficient to address each value uniquely.

Args:

kdims (optional): New list of key dimensions after reindexing force (bool, optional): Whether to drop non-unique items

Returns:

Reindexed object

relabel(label=None, group=None, depth=0)

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

select(selection_specs=None, **kwargs)

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

table(datatype=None, **kwargs)

Deprecated method to convert an MultiDimensionalMapping of Elements to a Table.

traverse(fn=None, specs=None, full_breadth=True)

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

property type

The type of elements stored in the mapping.

update(other)

Merges other item with this object

Args:
other: Object containing items to merge into this object

Must be a dictionary or NdMapping type

values()

Returns the values of all the elements.

class holoviews.core.ViewableElement(data, kdims=None, vdims=None, **params)[source]

Bases: holoviews.core.dimension.Dimensioned

A ViewableElement is a dimensioned datastructure that may be associated with a corresponding atomic visualization. An atomic visualization will display the data on a single set of axes (i.e. excludes multiple subplots that are displayed at once). The only new parameter introduced by ViewableElement is the title associated with the object for display.

Parameters inherited from:

group = param.String(default=’ViewableElement’)

A string describing the data wrapped by the object.

clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)

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

property ddims

The list of deep dimensions

dimension_values(dimension, expanded=True, flat=True)

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)

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)

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)

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)

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

map(map_fn, specs=None, clone=True)

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)

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, **kwargs)

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)

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

relabel(label=None, group=None, depth=0)

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

select(selection_specs=None, **kwargs)

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)

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.core.ViewableTree(items=None, identifier=None, parent=None, **kwargs)[source]

Bases: holoviews.core.tree.AttrTree, holoviews.core.dimension.Dimensioned

A ViewableTree is an AttrTree with Viewable objects as its leaf nodes. It combines the tree like data structure of a tree while extending it with the deep indexable properties of Dimensioned and LabelledData objects.

Parameters inherited from:

group = param.String(default=’ViewableTree’)

A string describing the data wrapped by the object.

clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)

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

property ddims

The list of deep dimensions

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

Return the values along the requested dimension.

Concatenates values on all nodes with 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)

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

filter(path_filters)

Filters the loaded AttrTree using the supplied path_filters.

property fixed

If fixed, no new paths can be created via attribute access

classmethod from_values(vals)[source]

Deprecated method to construct tree from list of objects

get(identifier, default=None)

Get a node of the AttrTree using its path string.

Args:

identifier: Path string of the node to return default: Value to return if no node is found

Returns:

The indexed node of the AttrTree

get_dimension(dimension, default=None, strict=False)

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)

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)

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

items()

Keys and nodes of the AttrTree

keys()

Keys of nodes in the AttrTree

map(map_fn, specs=None, clone=True)

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)

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.

classmethod merge(trees)

Merge a collection of AttrTree objects.

options(*args, **kwargs)

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

property path

Returns the path up to the root for the current node.

pop(identifier, default=None)

Pop a node of the AttrTree using its path string.

Args:

identifier: Path string of the node to return default: Value to return if no node is found

Returns:

The node that was removed from the AttrTree

range(dimension, data_range=True, dimension_range=True)

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

relabel(label=None, group=None, depth=0)

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

select(selection_specs=None, **kwargs)

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

set_path(path, val)

Set the given value at the supplied path where path is either a tuple of strings or a string in A.B.C format.

traverse(fn=None, specs=None, full_breadth=True)

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

property uniform

Whether items in tree have uniform dimensions

update(other)

Updated the contents of the current AttrTree with the contents of a second AttrTree.

values()

Nodes of the AttrTree


accessors Module

Inheritance diagram of holoviews.core.accessors

Module for accessor objects for viewable HoloViews objects.

class holoviews.core.accessors.Apply(obj, mode=None)[source]

Bases: object

Utility to apply a function or operation to all viewable elements inside the object.

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

Applies a aggregate function to all ViewableElements.

See Dimensioned.aggregate() and Apply.__call__() for more information.

opts(*args, **kwargs)[source]

Applies options to all ViewableElement objects.

See Dimensioned.opts() and Apply.__call__() for more information.

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

Applies a reduce function to all ViewableElement objects.

See Dimensioned.opts() and Apply.__call__() for more information.

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

Samples element values at supplied coordinates.

See Dataset.sample() and Apply.__call__() for more information.

select(**kwargs)[source]

Applies a selection to all ViewableElement objects.

See Dimensioned.opts() and Apply.__call__() for more information.

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

Applies transforms to all Datasets.

See Dataset.transform() and Apply.__call__() for more information.

class holoviews.core.accessors.Redim(obj, mode=None)[source]

Bases: object

Utility that supports re-dimensioning any HoloViews object via the redim method.

classmethod replace_dimensions(dimensions, overrides)[source]

Replaces dimensions in list with dictionary of overrides.

Args:

dimensions: List of dimensions overrides: Dictionary of dimension specs indexed by name

Returns:

list: List of dimensions with replacements applied


boundingregion Module

Inheritance diagram of holoviews.core.boundingregion

Bounding regions and bounding boxes.

File originally part of the Topographica project.

class holoviews.core.boundingregion.AARectangle(*points)[source]

Bases: object

Axis-aligned rectangle class.

Defines the smallest axis-aligned rectangle that encloses a set of points.

Usage: aar = AARectangle( (x1,y1),(x2,y2), … , (xN,yN) )

bottom()[source]

Return the y-coordinate of the bottom of the rectangle.

centroid()[source]

Return the centroid of the rectangle.

lbrt()[source]

Return (left,bottom,right,top) as a tuple.

left()[source]

Return the x-coordinate of the left side of the rectangle.

right()[source]

Return the x-coordinate of the right side of the rectangle.

top()[source]

Return the y-coordinate of the top of the rectangle.

class holoviews.core.boundingregion.BoundingBox(**args)[source]

Bases: holoviews.core.boundingregion.BoundingRegion

A rectangular bounding box defined either by two points forming an axis-aligned rectangle (or simply a radius for a square).

centroid()

Return the coordinates of the center of this BoundingBox

contains(x, y)[source]

Returns true if the given point is contained within the bounding box, where all boundaries of the box are considered to be inclusive.

contains_exclusive(x, y)[source]

Return True if the given point is contained within the bounding box, where the bottom and right boundaries are considered exclusive.

containsbb_exclusive(x)[source]

Returns true if the given BoundingBox x is contained within the bounding box, where at least one of the boundaries of the box has to be exclusive.

containsbb_inclusive(x)[source]

Returns true if the given BoundingBox x is contained within the bounding box, including cases of exact match.

lbrt()[source]

return left,bottom,right,top values for the BoundingBox.

upperexclusive_contains(x, y)[source]

Returns true if the given point is contained within the bounding box, where the right and upper boundaries are exclusive, and the left and lower boundaries are inclusive. Useful for tiling a plane into non-overlapping regions.

class holoviews.core.boundingregion.BoundingEllipse(**args)[source]

Bases: holoviews.core.boundingregion.BoundingBox

Similar to BoundingBox, but the region is the ellipse inscribed within the rectangle.

centroid()

Return the coordinates of the center of this BoundingBox

contains(x, y)[source]

Returns true if the given point is contained within the bounding box, where all boundaries of the box are considered to be inclusive.

contains_exclusive(x, y)

Return True if the given point is contained within the bounding box, where the bottom and right boundaries are considered exclusive.

containsbb_exclusive(x)

Returns true if the given BoundingBox x is contained within the bounding box, where at least one of the boundaries of the box has to be exclusive.

containsbb_inclusive(x)

Returns true if the given BoundingBox x is contained within the bounding box, including cases of exact match.

lbrt()

return left,bottom,right,top values for the BoundingBox.

upperexclusive_contains(x, y)

Returns true if the given point is contained within the bounding box, where the right and upper boundaries are exclusive, and the left and lower boundaries are inclusive. Useful for tiling a plane into non-overlapping regions.

class holoviews.core.boundingregion.BoundingRegion[source]

Bases: object

Abstract bounding region class, for any portion of a 2D plane.

Only subclasses can be instantiated directly.

centroid()[source]

Return the coordinates of the center of this BoundingBox

class holoviews.core.boundingregion.BoundingRegionParameter(default=BoundingBox(radius=0.5), **params)[source]

Bases: param.parameterized.Parameter

Parameter whose value can be any BoundingRegion instance, enclosing a region in a 2D plane.


dimension Module

Inheritance diagram of holoviews.core.dimension

Provides Dimension objects for tracking the properties of a value, axis or map dimension. Also supplies the Dimensioned abstract baseclass for classes that accept Dimension values.

class holoviews.core.dimension.Dimension(spec, **params)[source]

Bases: param.parameterized.Parameterized

Dimension objects are used to specify some important general features that may be associated with a collection of values.

For instance, a Dimension may specify that a set of numeric values actually correspond to ‘Height’ (dimension name), in units of meters, with a descriptive label ‘Height of adult males’.

All dimensions object have a name that identifies them and a label containing a suitable description. If the label is not explicitly specified it matches the name.

These two parameters define the core identity of the dimension object and must match if two dimension objects are to be considered equivalent. All other parameters are considered optional metadata and are not used when testing for equality.

Unlike all the other parameters, these core parameters can be used to construct a Dimension object from a tuple. This format is sufficient to define an identical Dimension:

Dimension(‘a’, label=’Dimension A’) == Dimension((‘a’, ‘Dimension A’))

Everything else about a dimension is considered to reflect non-semantic preferences. Examples include the default value (which may be used in a visualization to set an initial slider position), how the value is to rendered as text (which may be used to specify the printed floating point precision) or a suitable range of values to consider for a particular analysis.

Full unit support with automated conversions are on the HoloViews roadmap. Once rich unit objects are supported, the unit (or more specifically the type of unit) will be part of the core dimension specification used to establish equality.

Until this feature is implemented, there are two auxiliary parameters that hold some partial information about the unit: the name of the unit and whether or not it is cyclic. The name of the unit is used as part of the pretty-printed representation and knowing whether it is cyclic is important for certain operations.

label = param.String()

Unrestricted label used to describe the dimension. A label should succinctly describe the dimension and may contain any characters, including Unicode and LaTeX expression.

cyclic = param.Boolean(bounds=(0, 1), default=False)

Whether the range of this feature is cyclic such that the maximum allowed value (defined by the range parameter) is continuous with the minimum allowed value.

value_format = param.Callable()

Formatting function applied to each value before display.

range = param.Tuple(default=(None, None), length=2)

Specifies the minimum and maximum allowed values for a Dimension. None is used to represent an unlimited bound.

soft_range = param.Tuple(default=(None, None), length=2)

Specifies a minimum and maximum reference value, which may be overridden by the data.

type = param.Parameter()

Optional type associated with the Dimension values. The type may be an inbuilt constructor (such as int, str, float) or a custom class object.

default = param.Parameter()

Default value of the Dimension which may be useful for widget or other situations that require an initial or default value.

step = param.Number(inclusive_bounds=(True, True))

Optional floating point step specifying how frequently the underlying space should be sampled. May be used to define a discrete sampling over the range.

unit = param.String()

Optional unit string associated with the Dimension. For instance, the string ‘m’ may be used represent units of meters and ‘s’ to represent units of seconds.

values = param.List(bounds=(0, None), default=[])

Optional specification of the allowed value set for the dimension that may also be used to retain a categorical ordering.

clone(spec=None, **overrides)[source]

Clones the Dimension with new parameters

Derive a new Dimension that inherits existing parameters except for the supplied, explicit overrides

Args:

spec (tuple, optional): Dimension tuple specification **overrides: Dimension parameter overrides

Returns:

Cloned Dimension object

pprint()[source]

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

property pprint_label

The pretty-printed label string for the Dimension

pprint_value(value, print_unit=False)[source]

Applies the applicable formatter to the value.

Args:

value: Dimension value to format

Returns:

Formatted dimension value

pprint_value_string(value)[source]

Pretty print the dimension value and unit with title_format

Args:

value: Dimension value to format

Returns:

Formatted dimension value string with unit

property spec

“Returns the Dimensions tuple specification

Returns:

tuple: Dimension tuple specification

class holoviews.core.dimension.Dimensioned(data, kdims=None, vdims=None, **params)[source]

Bases: holoviews.core.dimension.LabelledData

Dimensioned is a base class that allows the data contents of a class to be associated with dimensions. The contents associated with dimensions may be partitioned into one of three types

  • key dimensions: These are the dimensions that can be indexed via

    the __getitem__ method. Dimension objects supporting key dimensions must support indexing over these dimensions and may also support slicing. This list ordering of dimensions describes the positional components of each multi-dimensional indexing operation.

    For instance, if the key dimension names are ‘weight’ followed by ‘height’ for Dimensioned object ‘obj’, then obj[80,175] indexes a weight of 80 and height of 175.

    Accessed using either kdims.

  • value dimensions: These dimensions correspond to any data held

    on the Dimensioned object not in the key dimensions. Indexing by value dimension is supported by dimension name (when there are multiple possible value dimensions); no slicing semantics is supported and all the data associated with that dimension will be returned at once. Note that it is not possible to mix value dimensions and deep dimensions.

    Accessed using either vdims.

  • deep dimensions: These are dynamically computed dimensions that

    belong to other Dimensioned objects that are nested in the data. Objects that support this should enable the _deep_indexable flag. Note that it is not possible to mix value dimensions and deep dimensions.

    Accessed using either ddims.

Dimensioned class support generalized methods for finding the range and type of values along a particular Dimension. The range method relies on the appropriate implementation of the dimension_values methods on subclasses.

The index of an arbitrary dimension is its positional index in the list of all dimensions, starting with the key dimensions, followed by the value dimensions and ending with the deep dimensions.

Parameters inherited from:

group = param.String(default=’Dimensioned’)

A string describing the data wrapped by the object.

cdims = param.Dict(class_=<class ‘dict’>, default=OrderedDict())

The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.

kdims = param.List(bounds=(0, None), default=[])

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

vdims = param.List(bounds=(0, None), default=[])

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

clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)

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

property ddims

The list of deep dimensions

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

map(map_fn, specs=None, clone=True)

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)

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, **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

relabel(label=None, group=None, depth=0)

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

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)

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.core.dimension.LabelledData(data, id=None, plot_id=None, **params)[source]

Bases: param.parameterized.Parameterized

LabelledData is a mix-in class designed to introduce the group and label parameters (and corresponding methods) to any class containing data. This class assumes that the core data contents will be held in the attribute called ‘data’.

Used together, group and label are designed to allow a simple and flexible means of addressing data. For instance, if you are collecting the heights of people in different demographics, you could specify the values of your objects as ‘Height’ and then use the label to specify the (sub)population.

In this scheme, one object may have the parameters set to [group=’Height’, label=’Children’] and another may use [group=’Height’, label=’Adults’].

Note: Another level of specification is implicit in the type (i.e class) of the LabelledData object. A full specification of a LabelledData object is therefore given by the tuple (<type>, <group>, label>). This additional level of specification is used in the traverse method.

Any strings can be used for the group and label, but it can be convenient to use a capitalized string of alphanumeric characters, in which case the keys used for matching in the matches and traverse method will correspond exactly to {type}.{group}.{label}. Otherwise the strings provided will be sanitized to be valid capitalized Python identifiers, which works fine but can sometimes be confusing.

group = param.String(default=’LabelledData’)

A string describing the type of data contained by the object. By default this will typically mirror the class name.

label = param.String(default=’’)

Optional label describing the data, typically reflecting where or how it was measured. The label should allow a specific measurement or dataset to be referenced for a given group.

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

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.

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

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.core.dimension.ViewableElement(data, kdims=None, vdims=None, **params)[source]

Bases: holoviews.core.dimension.Dimensioned

A ViewableElement is a dimensioned datastructure that may be associated with a corresponding atomic visualization. An atomic visualization will display the data on a single set of axes (i.e. excludes multiple subplots that are displayed at once). The only new parameter introduced by ViewableElement is the title associated with the object for display.

Parameters inherited from:

group = param.String(default=’ViewableElement’)

A string describing the data wrapped by the object.

clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)

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

property ddims

The list of deep dimensions

dimension_values(dimension, expanded=True, flat=True)

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)

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)

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)

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)

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

map(map_fn, specs=None, clone=True)

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)

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, **kwargs)

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)

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

relabel(label=None, group=None, depth=0)

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

select(selection_specs=None, **kwargs)

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)

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.core.dimension.ViewableTree(items=None, identifier=None, parent=None, **kwargs)[source]

Bases: holoviews.core.tree.AttrTree, holoviews.core.dimension.Dimensioned

A ViewableTree is an AttrTree with Viewable objects as its leaf nodes. It combines the tree like data structure of a tree while extending it with the deep indexable properties of Dimensioned and LabelledData objects.

Parameters inherited from:

group = param.String(default=’ViewableTree’)

A string describing the data wrapped by the object.

clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)

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

property ddims

The list of deep dimensions

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

Return the values along the requested dimension.

Concatenates values on all nodes with 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)

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

filter(path_filters)

Filters the loaded AttrTree using the supplied path_filters.

property fixed

If fixed, no new paths can be created via attribute access

classmethod from_values(vals)[source]

Deprecated method to construct tree from list of objects

get(identifier, default=None)

Get a node of the AttrTree using its path string.

Args:

identifier: Path string of the node to return default: Value to return if no node is found

Returns:

The indexed node of the AttrTree

get_dimension(dimension, default=None, strict=False)

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)

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)

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

items()

Keys and nodes of the AttrTree

keys()

Keys of nodes in the AttrTree

map(map_fn, specs=None, clone=True)

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)

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.

classmethod merge(trees)

Merge a collection of AttrTree objects.

options(*args, **kwargs)

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

property path

Returns the path up to the root for the current node.

pop(identifier, default=None)

Pop a node of the AttrTree using its path string.

Args:

identifier: Path string of the node to return default: Value to return if no node is found

Returns:

The node that was removed from the AttrTree

range(dimension, data_range=True, dimension_range=True)

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

relabel(label=None, group=None, depth=0)

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

select(selection_specs=None, **kwargs)

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

set_path(path, val)

Set the given value at the supplied path where path is either a tuple of strings or a string in A.B.C format.

traverse(fn=None, specs=None, full_breadth=True)

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

property uniform

Whether items in tree have uniform dimensions

update(other)

Updated the contents of the current AttrTree with the contents of a second AttrTree.

values()

Nodes of the AttrTree

holoviews.core.dimension.asdim(dimension)[source]

Convert the input to a Dimension.

Args:

dimension: tuple, dict or string type to convert to Dimension

Returns:

A Dimension object constructed from the dimension spec. No copy is performed if the input is already a Dimension.

holoviews.core.dimension.dimension_name(dimension)[source]

Return the Dimension.name for a dimension-like object.

Args:

dimension: Dimension or dimension string, tuple or dict

Returns:

The name of the Dimension or what would be the name if the input as converted to a Dimension.

holoviews.core.dimension.param_aliases(d)[source]

Called from __setstate__ in LabelledData in order to load old pickles with outdated parameter names.

Warning: We want to keep pickle hacking to a minimum!

holoviews.core.dimension.process_dimensions(kdims, vdims)[source]

Converts kdims and vdims to Dimension objects.

Args:
kdims: List or single key dimension(s) specified as strings,

tuples dicts or Dimension objects.

vdims: List or single value dimension(s) specified as strings,

tuples dicts or Dimension objects.

Returns:

Dictionary containing kdims and vdims converted to Dimension objects:

{‘kdims’: [Dimension(‘x’)], ‘vdims’: [Dimension(‘y’)]


element Module

Inheritance diagram of holoviews.core.element
class holoviews.core.element.Collator(data=None, **params)[source]

Bases: holoviews.core.ndmapping.NdMapping

Collator is an NdMapping type which can merge any number of HoloViews components with whatever level of nesting by inserting the Collators key dimensions on the HoloMaps. If the items in the Collator do not contain HoloMaps they will be created. Collator also supports filtering of Tree structures and dropping of constant dimensions.

Parameters inherited from:

group = param.String(default=’Collator’)

A string describing the data wrapped by the object.

vdims = param.List(bounds=(0, None), default=[])

Collator operates on HoloViews objects, if vdims are specified a value_transform function must also be supplied.

drop = param.List(bounds=(0, None), default=[])

List of dimensions to drop when collating data, specified as strings.

drop_constant = param.Boolean(bounds=(0, 1), default=False)

Whether to demote any non-varying key dimensions to constant dimensions.

filters = param.List(bounds=(0, None), default=[])

List of paths to drop when collating data, specified as strings or tuples.

progress_bar = param.Parameter()

The progress bar instance used to report progress. Set to None to disable progress bars.

merge_type = param.ClassSelector(class_=<class ‘holoviews.core.ndmapping.NdMapping’>, default=<class ‘holoviews.core.spaces.HoloMap’>)

value_transform = param.Callable()

If supplied the function will be applied on each Collator value during collation. This may be used to apply an operation to the data or load references from disk before they are collated into a displayable HoloViews object.

add_dimension(dimension, dim_pos, dim_val, vdim=False, **kwargs)

Adds a dimension and its values to the object

Requires the dimension name or object, the desired position in the key dimensions and a key value scalar or sequence of the same length as the existing keys.

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

clone(data=None, shared_data=True, *args, **overrides)

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

property ddims

The list of deep dimensions

dframe()

Deprecated method to convert a MultiDimensionalMapping to a pandas DataFrame. Conversion to a dataframe now only supported by specific subclasses such as UniformNdMapping types.

dimension_values(dimension, expanded=True, flat=True)

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)

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

drop_dimension(dimensions)

Drops dimension(s) from keys

Args:

dimensions: Dimension(s) to drop

Returns:

Clone of object with with dropped dimension(s)

get(key, default=None)

Standard get semantics for all mapping types

get_dimension(dimension, default=None, strict=False)

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)

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)

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, container_type=None, group_type=None, **kwargs)

Groups object by one or more dimensions

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

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.

property info

Prints information about the Dimensioned object, including the number and type of objects contained within it and information about its dimensions.

items()

Returns all elements as a list in (key,value) format.

keys()

Returns the keys of all the elements.

property last

Returns the item highest data item along the map dimensions.

property last_key

Returns the last key value.

map(map_fn, specs=None, clone=True)

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)

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.

merge_type

alias of holoviews.core.spaces.HoloMap

options(*args, **kwargs)

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

pop(key, default=None)

Standard pop semantics for all mapping types

range(dimension, data_range=True, dimension_range=True)

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

reindex(kdims=[], force=False)

Reindexes object dropping static or supplied kdims

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

Reducing the number of key dimensions will discard information from the keys. All data values are accessible in the newly created object as the new labels must be sufficient to address each value uniquely.

Args:

kdims (optional): New list of key dimensions after reindexing force (bool, optional): Whether to drop non-unique items

Returns:

Reindexed object

relabel(label=None, group=None, depth=0)

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

select(selection_specs=None, **kwargs)

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

property static_dimensions

Return all constant dimensions.

table(datatype=None, **kwargs)

Deprecated method to convert an MultiDimensionalMapping of Elements to a Table.

traverse(fn=None, specs=None, full_breadth=True)

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

update(other)

Merges other item with this object

Args:
other: Object containing items to merge into this object

Must be a dictionary or NdMapping type

values()

Returns the values of all the elements.

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

Bases: holoviews.core.dimension.ViewableElement, holoviews.core.layout.Composable

CompositeOverlay provides a common baseclass for Overlay classes.

Parameters inherited from:

clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)

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

property ddims

The list of deep dimensions

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)

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)

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)

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)

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, index=0, **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 index (int, optional): Index of layer to apply hist to

Returns:

AdjointLayout of element and histogram or just the histogram

map(map_fn, specs=None, clone=True)

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)

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, **kwargs)

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)

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

relabel(label=None, group=None, depth=0)

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

select(selection_specs=None, **kwargs)

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)

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.core.element.Dimensioned(data, kdims=None, vdims=None, **params)[source]

Bases: holoviews.core.dimension.LabelledData

Dimensioned is a base class that allows the data contents of a class to be associated with dimensions. The contents associated with dimensions may be partitioned into one of three types

  • key dimensions: These are the dimensions that can be indexed via

    the __getitem__ method. Dimension objects supporting key dimensions must support indexing over these dimensions and may also support slicing. This list ordering of dimensions describes the positional components of each multi-dimensional indexing operation.

    For instance, if the key dimension names are ‘weight’ followed by ‘height’ for Dimensioned object ‘obj’, then obj[80,175] indexes a weight of 80 and height of 175.

    Accessed using either kdims.

  • value dimensions: These dimensions correspond to any data held

    on the Dimensioned object not in the key dimensions. Indexing by value dimension is supported by dimension name (when there are multiple possible value dimensions); no slicing semantics is supported and all the data associated with that dimension will be returned at once. Note that it is not possible to mix value dimensions and deep dimensions.

    Accessed using either vdims.

  • deep dimensions: These are dynamically computed dimensions that

    belong to other Dimensioned objects that are nested in the data. Objects that support this should enable the _deep_indexable flag. Note that it is not possible to mix value dimensions and deep dimensions.

    Accessed using either ddims.

Dimensioned class support generalized methods for finding the range and type of values along a particular Dimension. The range method relies on the appropriate implementation of the dimension_values methods on subclasses.

The index of an arbitrary dimension is its positional index in the list of all dimensions, starting with the key dimensions, followed by the value dimensions and ending with the deep dimensions.

Parameters inherited from:

group = param.String(default=’Dimensioned’)

A string describing the data wrapped by the object.

cdims = param.Dict(class_=<class ‘dict’>, default=OrderedDict())

The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.

kdims = param.List(bounds=(0, None), default=[])

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

vdims = param.List(bounds=(0, None), default=[])

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

clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)

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

property ddims

The list of deep dimensions

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

map(map_fn, specs=None, clone=True)

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)

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, **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

relabel(label=None, group=None, depth=0)

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

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)

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.core.element.Element(data, kdims=None, vdims=None, **params)[source]

Bases: holoviews.core.dimension.ViewableElement, holoviews.core.layout.Composable, holoviews.core.overlay.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:

group = param.String(default=’Element’)

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)

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

classmethod collapse_data(data, function=None, kdims=None, **kwargs)[source]

Deprecated method to perform collapse operations, which may now be performed through concatenation and aggregation.

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)

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)

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)

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)

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)

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)

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

mapping(kdims=None, vdims=None, **kwargs)[source]

Deprecated method to convert data to dictionary

matches(spec)

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, **kwargs)

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)

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=[], 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)

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=[], 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 nd-coordinates to sample bounds: Bounds of the region to sample

Defined as two-tuple for 1D sampling and four-tuple for 2D sampling.

closest: Whether to snap to closest coordinates **kwargs: Coordinates specified as keyword pairs

Keywords of dimensions and scalar coordinates

Returns:

Element containing the sampled coordinates

select(selection_specs=None, **kwargs)

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

table(datatype=None)[source]

Deprecated method to convert any Element to a Table.

traverse(fn=None, specs=None, full_breadth=True)

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.core.element.Element2D(data, kdims=None, vdims=None, **params)[source]

Bases: holoviews.core.element.Element

Parameters inherited from:

extents = param.Tuple(default=(None, None, None, None), length=4)

Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.

array(dimensions=None)

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)

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)

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

classmethod collapse_data(data, function=None, kdims=None, **kwargs)

Deprecated method to perform collapse operations, which may now be performed through concatenation and aggregation.

property ddims

The list of deep dimensions

dframe(dimensions=None, multi_index=False)

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)

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)

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)

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)

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)

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)

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)

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

mapping(kdims=None, vdims=None, **kwargs)

Deprecated method to convert data to dictionary

matches(spec)

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, **kwargs)

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)

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=[], function=None, spreadfn=None, **reduction)

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)

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=[], bounds=None, closest=False, **sample_values)

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 nd-coordinates to sample bounds: Bounds of the region to sample

Defined as two-tuple for 1D sampling and four-tuple for 2D sampling.

closest: Whether to snap to closest coordinates **kwargs: Coordinates specified as keyword pairs

Keywords of dimensions and scalar coordinates

Returns:

Element containing the sampled coordinates

select(selection_specs=None, **kwargs)

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

table(datatype=None)

Deprecated method to convert any Element to a Table.

traverse(fn=None, specs=None, full_breadth=True)

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.core.element.Element3D(data, kdims=None, vdims=None, **params)[source]

Bases: holoviews.core.element.Element2D

Parameters inherited from:

extents = param.Tuple(default=(None, None, None, None, None, None), length=6)

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

array(dimensions=None)

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)

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)

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

classmethod collapse_data(data, function=None, kdims=None, **kwargs)

Deprecated method to perform collapse operations, which may now be performed through concatenation and aggregation.

property ddims

The list of deep dimensions

dframe(dimensions=None, multi_index=False)

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)

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)

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)

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)

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)

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)

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)

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

mapping(kdims=None, vdims=None, **kwargs)

Deprecated method to convert data to dictionary

matches(spec)

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, **kwargs)

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)

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=[], function=None, spreadfn=None, **reduction)

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)

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=[], bounds=None, closest=False, **sample_values)

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 nd-coordinates to sample bounds: Bounds of the region to sample

Defined as two-tuple for 1D sampling and four-tuple for 2D sampling.

closest: Whether to snap to closest coordinates **kwargs: Coordinates specified as keyword pairs

Keywords of dimensions and scalar coordinates

Returns:

Element containing the sampled coordinates

select(selection_specs=None, **kwargs)

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

table(datatype=None)

Deprecated method to convert any Element to a Table.

traverse(fn=None, specs=None, full_breadth=True)

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.core.element.