holoviews.element Package


element Package

Inheritance diagram of holoviews.element

class holoviews.element. Area ( data , **kwargs ) [source]

Bases: holoviews.element.chart.Curve

An Area Element represents the area under a Curve and is specified in the same format as a regular Curve, with the key dimension corresponding to a column of x-values and the value dimension corresponding to a column of y-values. Optionally a second value dimension may be supplied to shade the region between the curves.

param List vdims ( allow_None=False, bounds=(1, None), constant=False, default=[Dimension(‘y’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The value dimensions of the Chart, usually corresponding to a number of dependent variables.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=Area, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
A string describing the data wrapped by the object.
param List datatype ( allow_None=False, bounds=(0, None), constant=False, default=[‘array’, ‘dataframe’, ‘dictionary’, ‘grid’, ‘ndelement’, ‘cube’, ‘xarray’, ‘dask’], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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).
param List kdims ( allow_None=False, bounds=(1, 2), constant=False, default=[Dimension(‘x’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The key dimensions of the Chart, determining the number of indexable dimensions.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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..
param Tuple extents ( allow_None=False, constant=False, default=(None, None, None, None), instantiate=False, length=4, pickle_default_value=True, precedence=None, readonly=False )
Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.
add_dimension ( dimension , dim_pos , dim_val , vdim=False , **kwargs )

Create a new object with an additional key dimensions. 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.

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

Aggregates over the supplied key dimensions with the defined function.

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

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

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

closest ( coords=[] , **kwargs )

Given a single coordinate or multiple coordinates as a tuple or list of tuples or keyword arguments matching the dimension closest will find the closest actual x/y coordinates. Different Element types should implement this appropriately depending on the space they represent, if the Element does not support snapping raise NotImplementedError.

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

Class method to collapse a list of data matching the data format of the Element type. By implementing this method HoloMap can collapse multiple Elements of the same type. The kwargs are passed to the collapse function. The collapse function must support the numpy style axis selection. Valid function include: np.mean, np.sum, np.product, np.std, scipy.stats.kurtosis etc. Some data backends also require the key dimensions to aggregate over.

ddims

The list of deep dimensions

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

dframe ( dimensions=None )

Returns the data in the form of a DataFrame. Supplying a list of dimensions filters the dataframe. If the data is already a DataFrame a copy is returned.

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

Returns the values along a particular dimension. If unique values are requested will return only unique values.

dimensions ( selection=u'all' , label=False )

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.

force_new_dynamic_value = <functools.partial object>
get_dimension ( dimension , default=None , strict=False )

Access a Dimension object by name or index. Returns the default value if the dimension is not found and strict is False. If strict is True, a KeyError is raised instead.

get_dimension_index ( dim )

Returns the index of the requested dimension.

get_dimension_type ( dim )

Returns the specified Dimension type if specified or if the dimension_values types are consistent otherwise None is returned.

get_param_values ( onlychanged=False )

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

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

Return the results of a groupby operation over the specified dimensions as an object of type container_type (expected to be dictionary-like).

Keys vary over the columns (dimensions) and the corresponding values are collections of group_type (e.g an Element, list, tuple) constructed with kwargs (if supplied).

If dynamic is requested container_type is automatically set to a DynamicMap, allowing dynamic exploration of large datasets. If the data does not represent a full cartesian grid of the requested dimensions some Elements will be empty.

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

The hist method generates a histogram to be adjoined to the Element in an AdjointLayout. By default the histogram is computed along the first value dimension of the Element, however any dimension may be selected. The number of bins and the bin_ranges and any kwargs to be passed to the histogram operation may also be supplied.

iloc

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]]

inspect_value = <functools.partial object>
map ( map_fn , specs=None , clone=True )

Recursively replaces elements using a map function when the specification applies.

matches ( spec )

A specification may be a class, a tuple or a string. Equivalent to isinstance if a class is supplied, otherwise matching occurs on type, group and label. These may be supplied as a tuple of strings or as a single string of the form “{type}.{group}.{label}”. Matching may be done on {type} alone, {type}.{group}, or {type}.{group}.{label}. The strings for the type, group, and label will each be sanitized before the match, and so the sanitized versions of those values will need to be provided if the match is to succeed.

message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

ndloc

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]]

opts ( options=None , **kwargs )

Apply the supplied options to a clone of the object which is then returned. Note that if no options are supplied at all, all ids are reset.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

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

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

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

range ( dim , data_range=True )

Computes the range of values along a supplied dimension, taking into account the range and soft_range defined on the Dimension object.

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

Allows reducing the values along one or more key dimension with the supplied function. The dimensions may be supplied as a list and a function to apply or a mapping between the dimensions and functions to apply along each dimension.

reindex ( kdims=None , vdims=None )

Create a new object with a re-ordered set of dimensions. Allows converting key dimensions to value dimensions and vice versa.

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

Assign a new label and/or group to an existing LabelledData object, creating a clone of the object with the new settings.

sample ( samples=[] , closest=True , **kwargs )

Allows sampling of Dataset as an iterator of coordinates matching the key dimensions, returning a new object containing just the selected samples. Alternatively may supply kwargs to sample a coordinate on an object. By default it will attempt to snap to the nearest coordinate if the Element supports it, snapping may be disabled with the closest argument.

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

Variant of __repr__ designed for generating a runnable script.

select ( selection_specs=None , **selection )

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

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object>
set_param = <functools.partial object>
shape

Returns the shape of the data.

sort ( by=[] )

Sorts the data by the values along the supplied dimensions.

classmethod stack ( areas ) [source]

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

state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

table ( datatype=None )

Converts the data Element to a Table, optionally may specify a supported data type. The default data types are ‘numpy’ (for homogeneous data), ‘dataframe’, and ‘dictionary’.

to

Property to create a conversion interface with methods to convert to other Element types.

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

Traverses any nested LabelledData object (i.e LabelledData objects containing LabelledData objects), applying the supplied function to each constituent element if the supplied specifications. The output of these function calls are collected and returned in the accumulator list.

If specs is None, all constituent elements are processed. Otherwise, specs must be a list of type.group.label specs, types, and functions.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

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

Bases: holoviews.element.path.Path

A BaseShape is a Path that can be succinctly expressed by a small number of parameters instead of a full path specification. For instance, a circle may be expressed by the center position and radius instead of an explicit list of path coordinates.

param List vdims ( allow_None=False, bounds=(0, None), constant=True, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=Path, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
A string describing the data wrapped by the object.
param List kdims ( allow_None=False, bounds=(2, 2), constant=True, default=[Dimension(‘x’), Dimension(‘y’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The label of the x- and y-dimension of the Image in form of a string or dimension object.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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..
param Tuple extents ( allow_None=False, constant=False, default=(None, None, None, None), instantiate=False, length=4, pickle_default_value=True, precedence=None, readonly=False )
Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.
clone ( *args , **overrides ) [source]

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

closest ( coords )

Class method that returns the exact keys for a given list of coordinates. The supplied bounds defines the extent within which the samples are drawn and the optional shape argument is the shape of the numpy array (typically the shape of the .data attribute) when applicable.

ddims

The list of deep dimensions

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

dimensions ( selection=u'all' , label=False )

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.

force_new_dynamic_value = <functools.partial object>
get_dimension ( dimension , default=None , strict=False )

Access a Dimension object by name or index. Returns the default value if the dimension is not found and strict is False. If strict is True, a KeyError is raised instead.

get_dimension_index ( dim )

Returns the index of the requested dimension.

get_dimension_type ( dim )

Returns the specified Dimension type if specified or if the dimension_values types are consistent otherwise None is returned.

get_param_values ( onlychanged=False )

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

get_value_generator = <functools.partial object>
hist ( dimension=None , num_bins=20 , bin_range=None , adjoin=True , individually=True , **kwargs )

The hist method generates a histogram to be adjoined to the Element in an AdjointLayout. By default the histogram is computed along the first value dimension of the Element, however any dimension may be selected. The number of bins and the bin_ranges and any kwargs to be passed to the histogram operation may also be supplied.

inspect_value = <functools.partial object>
map ( map_fn , specs=None , clone=True )

Recursively replaces elements using a map function when the specification applies.

matches ( spec )

A specification may be a class, a tuple or a string. Equivalent to isinstance if a class is supplied, otherwise matching occurs on type, group and label. These may be supplied as a tuple of strings or as a single string of the form “{type}.{group}.{label}”. Matching may be done on {type} alone, {type}.{group}, or {type}.{group}.{label}. The strings for the type, group, and label will each be sanitized before the match, and so the sanitized versions of those values will need to be provided if the match is to succeed.

message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

opts ( options=None , **kwargs )

Apply the supplied options to a clone of the object which is then returned. Note that if no options are supplied at all, all ids are reset.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

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

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

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

range ( dimension , data_range=True )

Returns the range of values along the specified dimension.

If data_range is True, the data may be used to try and infer the appropriate range. Otherwise, (None,None) is returned to indicate that no range is defined.

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

Base class signature to demonstrate API for reducing Elements, using some reduce function, e.g. np.mean, which is applied along a particular Dimension. The dimensions and reduce functions should be passed as keyword arguments or as a list of dimensions and a single function.

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

Assign a new label and/or group to an existing LabelledData object, creating a clone of the object with the new settings.

sample ( samples=[] , **sample_values )

Base class signature to demonstrate API for sampling Elements. To sample an Element supply either a list of sampels or keyword arguments, where the key should match an existing key dimension on the Element.

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

Variant of __repr__ designed for generating a runnable script.

select ( selection_specs=None , **kwargs )

Allows slicing or indexing into the Dimensioned object by supplying the dimension and index/slice as key value pairs. Select descends recursively through the data structure applying the key dimension selection. The ‘value’ keyword allows selecting the value dimensions on objects which have any declared.

The selection may also be selectively applied to specific objects by supplying the selection_specs as an iterable of type.group.label specs, types or functions.

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object>
set_param = <functools.partial object>
state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

table ( datatype=None )

Converts the data Element to a Table, optionally may specify a supported data type. The default data types are ‘numpy’ (for homogeneous data), ‘dataframe’, and ‘dictionary’.

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

Traverses any nested LabelledData object (i.e LabelledData objects containing LabelledData objects), applying the supplied function to each constituent element if the supplied specifications. The output of these function calls are collected and returned in the accumulator list.

If specs is None, all constituent elements are processed. Otherwise, specs must be a list of type.group.label specs, types, and functions.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

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

Bases: holoviews.element.raster.Image

An RGB element is a Image containing channel data for the the red, green, blue and (optionally) the alpha channels. The values of each channel must be in the range 0.0 to 1.0.

In input array may have a shape of NxMx4 or NxMx3. In the latter case, the defined alpha dimension parameter is appended to the list of value dimensions.

param List vdims ( allow_None=False, bounds=(3, 4), constant=False, default=[Dimension(‘R’), Dimension(‘G’), Dimension(‘B’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The dimension description of the data held in the matrix. If an alpha channel is supplied, the defined alpha_dimension is automatically appended to this list.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=RGB, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
A string describing the data wrapped by the object.
param List datatype ( allow_None=False, bounds=(0, None), constant=False, default=[‘image’, ‘grid’, ‘xarray’, ‘cube’, ‘dataframe’, ‘dictionary’], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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).
param List kdims ( allow_None=False, bounds=(2, 2), constant=True, default=[Dimension(‘x’), Dimension(‘y’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The label of the x- and y-dimension of the Raster in form of a string or dimension object.
param ClassSelector bounds ( allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The bounding region in sheet coordinates containing the data.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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..
param ClassSelector alpha_dimension ( allow_None=False, constant=False, default=A, instantiate=False, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The alpha dimension definition to add the value dimensions if an alpha channel is supplied.
param Tuple extents ( allow_None=False, constant=False, default=(None, None, None, None), instantiate=False, length=4, pickle_default_value=True, precedence=None, readonly=False )
Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.
add_dimension ( dimension , dim_pos , dim_val , vdim=False , **kwargs )

Create a new object with an additional key dimensions. 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.

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

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

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

closest ( coords=[] , **kwargs )

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

closest_cell_center ( x , y )

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

ddims

The list of deep dimensions

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

dframe ( dimensions=None )

Returns the data in the form of a DataFrame. Supplying a list of dimensions filters the dataframe. If the data is already a DataFrame a copy is returned.

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

Returns the values along a particular dimension. If unique values are requested will return only unique values.

dimensions ( selection=u'all' , label=False )

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.

force_new_dynamic_value = <functools.partial object>
get_dimension ( dimension , default=None , strict=False )

Access a Dimension object by name or index. Returns the default value if the dimension is not found and strict is False. If strict is True, a KeyError is raised instead.

get_dimension_index ( dim )

Returns the index of the requested dimension.

get_dimension_type ( dim )

Returns the specified Dimension type if specified or if the dimension_values types are consistent otherwise None is returned.

get_param_values ( onlychanged=False )

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

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

Return the results of a groupby operation over the specified dimensions as an object of type container_type (expected to be dictionary-like).

Keys vary over the columns (dimensions) and the corresponding values are collections of group_type (e.g an Element, list, tuple) constructed with kwargs (if supplied).

If dynamic is requested container_type is automatically set to a DynamicMap, allowing dynamic exploration of large datasets. If the data does not represent a full cartesian grid of the requested dimensions some Elements will be empty.

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

The hist method generates a histogram to be adjoined to the Element in an AdjointLayout. By default the histogram is computed along the first value dimension of the Element, however any dimension may be selected. The number of bins and the bin_ranges and any kwargs to be passed to the histogram operation may also be supplied.

iloc

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]]

inspect_value = <functools.partial object>
classmethod load_image ( filename , height=1 , array=False , bounds=None , bare=False , **kwargs ) [source]

Returns an raster element or raw numpy array from a PNG image file, using matplotlib.

The specified height determines the bounds of the raster object in sheet coordinates: by default the height is 1 unit with the width scaled appropriately by the image aspect ratio.

Note that as PNG images are encoded as RGBA, the red component maps to the first channel, the green component maps to the second component etc. For RGB elements, this mapping is trivial but may be important for subclasses e.g. for HSV elements.

Setting bare=True will apply options disabling axis labels displaying just the bare image. Any additional keyword arguments will be passed to the Image object.

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

Recursively replaces elements using a map function when the specification applies.

matches ( spec )

A specification may be a class, a tuple or a string. Equivalent to isinstance if a class is supplied, otherwise matching occurs on type, group and label. These may be supplied as a tuple of strings or as a single string of the form “{type}.{group}.{label}”. Matching may be done on {type} alone, {type}.{group}, or {type}.{group}.{label}. The strings for the type, group, and label will each be sanitized before the match, and so the sanitized versions of those values will need to be provided if the match is to succeed.

matrix2sheet ( float_row , float_col )

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 )

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.

message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

ndloc

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]]

opts ( options=None , **kwargs )

Apply the supplied options to a clone of the object which is then returned. Note that if no options are supplied at all, all ids are reset.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

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

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

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

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

Allows reducing the values along one or more key dimension with the supplied function. The dimensions may be supplied as a list and a function to apply or a mapping between the dimensions and functions to apply along each dimension.

reindex ( kdims=None , vdims=None )

Create a new object with a re-ordered set of dimensions. Allows converting key dimensions to value dimensions and vice versa.

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

Assign a new label and/or group to an existing LabelledData object, creating a clone of the object with the new settings.

rgb

Returns the corresponding RGB element.

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

sample ( samples=[] , **kwargs )

Allows sampling of an Image as an iterator of coordinates matching the key dimensions, returning a new object containing just the selected samples. Alternatively may supply kwargs to sample a coordinate on an object. On an Image the coordinates are continuously indexed and will always snap to the nearest coordinate.

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

Variant of __repr__ designed for generating a runnable script.

select ( selection_specs=None , **selection )

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

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object>
set_param = <functools.partial object>
shape

Returns the shape of the data.

sheet2matrix ( x , y )

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 )

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

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.

sort ( by=[] )

Sorts the data by the values along the supplied dimensions.

state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

table ( datatype=None )

Converts the data Element to a Table, optionally may specify a supported data type. The default data types are ‘numpy’ (for homogeneous data), ‘dataframe’, and ‘dictionary’.

to

Property to create a conversion interface with methods to convert to other Element types.

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

Traverses any nested LabelledData object (i.e LabelledData objects containing LabelledData objects), applying the supplied function to each constituent element if the supplied specifications. The output of these function calls are collected and returned in the accumulator list.

If specs is None, all constituent elements are processed. Otherwise, specs must be a list of type.group.label specs, types, and functions.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

xdensity

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

ydensity

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

class holoviews.element. Spread ( data , **kwargs ) [source]

Bases: holoviews.element.chart.ErrorBars

Spread is a Chart Element type respresenting a spread of values as given by a mean and standard error or confidence intervals. Just like the ErrorBars Element type, mean and deviations from the mean should be supplied as either an Nx3 or Nx4 array representing the x-values, mean values and symmetric or assymetric errors respective. Internally the data is always expanded to an Nx4 array.

param List vdims ( allow_None=False, bounds=(1, 3), constant=True, default=[Dimension(‘y’), Dimension(‘yerror’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The value dimensions of the Chart, usually corresponding to a number of dependent variables.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=Spread, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
A string describing the quantitity measured by the ErrorBars object.
param List datatype ( allow_None=False, bounds=(0, None), constant=False, default=[‘array’, ‘dataframe’, ‘dictionary’, ‘grid’, ‘ndelement’, ‘cube’, ‘xarray’, ‘dask’], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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).
param List kdims ( allow_None=False, bounds=(1, 2), constant=True, default=[Dimension(‘x’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The Dimensions corresponding to the x- and y-positions of the error bars.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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..
param Tuple extents ( allow_None=False, constant=False, default=(None, None, None, None), instantiate=False, length=4, pickle_default_value=True, precedence=None, readonly=False )
Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.
add_dimension ( dimension , dim_pos , dim_val , vdim=False , **kwargs )

Create a new object with an additional key dimensions. 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.

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

Aggregates over the supplied key dimensions with the defined function.

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

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

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

closest ( coords=[] , **kwargs )

Given a single coordinate or multiple coordinates as a tuple or list of tuples or keyword arguments matching the dimension closest will find the closest actual x/y coordinates. Different Element types should implement this appropriately depending on the space they represent, if the Element does not support snapping raise NotImplementedError.

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

Class method to collapse a list of data matching the data format of the Element type. By implementing this method HoloMap can collapse multiple Elements of the same type. The kwargs are passed to the collapse function. The collapse function must support the numpy style axis selection. Valid function include: np.mean, np.sum, np.product, np.std, scipy.stats.kurtosis etc. Some data backends also require the key dimensions to aggregate over.

ddims

The list of deep dimensions

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

dframe ( dimensions=None )

Returns the data in the form of a DataFrame. Supplying a list of dimensions filters the dataframe. If the data is already a DataFrame a copy is returned.

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

Returns the values along a particular dimension. If unique values are requested will return only unique values.

dimensions ( selection=u'all' , label=False )

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.

force_new_dynamic_value = <functools.partial object>
get_dimension ( dimension , default=None , strict=False )

Access a Dimension object by name or index. Returns the default value if the dimension is not found and strict is False. If strict is True, a KeyError is raised instead.

get_dimension_index ( dim )

Returns the index of the requested dimension.

get_dimension_type ( dim )

Returns the specified Dimension type if specified or if the dimension_values types are consistent otherwise None is returned.

get_param_values ( onlychanged=False )

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

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

Return the results of a groupby operation over the specified dimensions as an object of type container_type (expected to be dictionary-like).

Keys vary over the columns (dimensions) and the corresponding values are collections of group_type (e.g an Element, list, tuple) constructed with kwargs (if supplied).

If dynamic is requested container_type is automatically set to a DynamicMap, allowing dynamic exploration of large datasets. If the data does not represent a full cartesian grid of the requested dimensions some Elements will be empty.

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

The hist method generates a histogram to be adjoined to the Element in an AdjointLayout. By default the histogram is computed along the first value dimension of the Element, however any dimension may be selected. The number of bins and the bin_ranges and any kwargs to be passed to the histogram operation may also be supplied.

iloc

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]]

inspect_value = <functools.partial object>
map ( map_fn , specs=None , clone=True )

Recursively replaces elements using a map function when the specification applies.

matches ( spec )

A specification may be a class, a tuple or a string. Equivalent to isinstance if a class is supplied, otherwise matching occurs on type, group and label. These may be supplied as a tuple of strings or as a single string of the form “{type}.{group}.{label}”. Matching may be done on {type} alone, {type}.{group}, or {type}.{group}.{label}. The strings for the type, group, and label will each be sanitized before the match, and so the sanitized versions of those values will need to be provided if the match is to succeed.

message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

ndloc

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]]

opts ( options=None , **kwargs )

Apply the supplied options to a clone of the object which is then returned. Note that if no options are supplied at all, all ids are reset.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

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

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

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

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

Allows reducing the values along one or more key dimension with the supplied function. The dimensions may be supplied as a list and a function to apply or a mapping between the dimensions and functions to apply along each dimension.

reindex ( kdims=None , vdims=None )

Create a new object with a re-ordered set of dimensions. Allows converting key dimensions to value dimensions and vice versa.

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

Assign a new label and/or group to an existing LabelledData object, creating a clone of the object with the new settings.

sample ( samples=[] , closest=True , **kwargs )

Allows sampling of Dataset as an iterator of coordinates matching the key dimensions, returning a new object containing just the selected samples. Alternatively may supply kwargs to sample a coordinate on an object. By default it will attempt to snap to the nearest coordinate if the Element supports it, snapping may be disabled with the closest argument.

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

Variant of __repr__ designed for generating a runnable script.

select ( selection_specs=None , **selection )

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

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object>
set_param = <functools.partial object>
shape

Returns the shape of the data.

sort ( by=[] )

Sorts the data by the values along the supplied dimensions.

state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

table ( datatype=None )

Converts the data Element to a Table, optionally may specify a supported data type. The default data types are ‘numpy’ (for homogeneous data), ‘dataframe’, and ‘dictionary’.

to

Property to create a conversion interface with methods to convert to other Element types.

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

Traverses any nested LabelledData object (i.e LabelledData objects containing LabelledData objects), applying the supplied function to each constituent element if the supplied specifications. The output of these function calls are collected and returned in the accumulator list.

If specs is None, all constituent elements are processed. Otherwise, specs must be a list of type.group.label specs, types, and functions.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

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

Bases: holoviews.element.path.Path

Contours is a type of Path that is also associated with a value (the contour level).

param List vdims ( allow_None=False, bounds=(1, 1), constant=False, default=[Dimension(‘Level’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
Contours optionally accept a value dimension, corresponding to the supplied values.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=Contours, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
A string describing the data wrapped by the object.
param Number level ( allow_None=True, bounds=None, constant=False, default=None, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, softbounds=None, time_dependent=False, time_fn=<Time Time00001> )
Optional level associated with the set of Contours.
param List kdims ( allow_None=False, bounds=(2, 2), constant=True, default=[Dimension(‘x’), Dimension(‘y’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The label of the x- and y-dimension of the Image in form of a string or dimension object.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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..
param Tuple extents ( allow_None=False, constant=False, default=(None, None, None, None), instantiate=False, length=4, pickle_default_value=True, precedence=None, readonly=False )
Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.
clone ( data=None , shared_data=True , new_type=None , *args , **overrides )

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

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

closest ( coords )

Class method that returns the exact keys for a given list of coordinates. The supplied bounds defines the extent within which the samples are drawn and the optional shape argument is the shape of the numpy array (typically the shape of the .data attribute) when applicable.

ddims

The list of deep dimensions

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

dimensions ( selection=u'all' , label=False )

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.

force_new_dynamic_value = <functools.partial object>
get_dimension ( dimension , default=None , strict=False )

Access a Dimension object by name or index. Returns the default value if the dimension is not found and strict is False. If strict is True, a KeyError is raised instead.

get_dimension_index ( dim )

Returns the index of the requested dimension.

get_dimension_type ( dim )

Returns the specified Dimension type if specified or if the dimension_values types are consistent otherwise None is returned.

get_param_values ( onlychanged=False )

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

get_value_generator = <functools.partial object>
hist ( dimension=None , num_bins=20 , bin_range=None , adjoin=True , individually=True , **kwargs )

The hist method generates a histogram to be adjoined to the Element in an AdjointLayout. By default the histogram is computed along the first value dimension of the Element, however any dimension may be selected. The number of bins and the bin_ranges and any kwargs to be passed to the histogram operation may also be supplied.

inspect_value = <functools.partial object>
map ( map_fn , specs=None , clone=True )

Recursively replaces elements using a map function when the specification applies.

matches ( spec )

A specification may be a class, a tuple or a string. Equivalent to isinstance if a class is supplied, otherwise matching occurs on type, group and label. These may be supplied as a tuple of strings or as a single string of the form “{type}.{group}.{label}”. Matching may be done on {type} alone, {type}.{group}, or {type}.{group}.{label}. The strings for the type, group, and label will each be sanitized before the match, and so the sanitized versions of those values will need to be provided if the match is to succeed.

message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

opts ( options=None , **kwargs )

Apply the supplied options to a clone of the object which is then returned. Note that if no options are supplied at all, all ids are reset.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

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

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

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

range ( dimension , data_range=True )

Returns the range of values along the specified dimension.

If data_range is True, the data may be used to try and infer the appropriate range. Otherwise, (None,None) is returned to indicate that no range is defined.

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

Base class signature to demonstrate API for reducing Elements, using some reduce function, e.g. np.mean, which is applied along a particular Dimension. The dimensions and reduce functions should be passed as keyword arguments or as a list of dimensions and a single function.

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

Assign a new label and/or group to an existing LabelledData object, creating a clone of the object with the new settings.

sample ( samples=[] , **sample_values )

Base class signature to demonstrate API for sampling Elements. To sample an Element supply either a list of sampels or keyword arguments, where the key should match an existing key dimension on the Element.

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

Variant of __repr__ designed for generating a runnable script.

select ( selection_specs=None , **kwargs )

Allows slicing or indexing into the Dimensioned object by supplying the dimension and index/slice as key value pairs. Select descends recursively through the data structure applying the key dimension selection. The ‘value’ keyword allows selecting the value dimensions on objects which have any declared.

The selection may also be selectively applied to specific objects by supplying the selection_specs as an iterable of type.group.label specs, types or functions.

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object>
set_param = <functools.partial object>
state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

table ( datatype=None )

Converts the data Element to a Table, optionally may specify a supported data type. The default data types are ‘numpy’ (for homogeneous data), ‘dataframe’, and ‘dictionary’.

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

Traverses any nested LabelledData object (i.e LabelledData objects containing LabelledData objects), applying the supplied function to each constituent element if the supplied specifications. The output of these function calls are collected and returned in the accumulator list.

If specs is None, all constituent elements are processed. Otherwise, specs must be a list of type.group.label specs, types, and functions.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

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

Bases: holoviews.element.raster.Raster

QuadMesh is a Raster type to hold x- and y- bin values with associated values. The x- and y-values of the QuadMesh may be supplied either as the edges of each bin allowing uneven sampling or as the bin centers, which will be converted to evenly sampled edges.

As a secondary but less supported mode QuadMesh can contain a mesh of quadrilateral coordinates that is not laid out in a grid. The data should then be supplied as three separate 2D arrays for the x-/y-coordinates and grid values.

param List vdims ( allow_None=False, bounds=(1, 1), constant=False, default=[Dimension(‘z’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The dimension description of the data held in the matrix.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=QuadMesh, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
A string describing the data wrapped by the object.
param List kdims ( allow_None=False, bounds=(0, None), constant=False, default=[Dimension(‘x’), Dimension(‘y’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The label of the x- and y-dimension of the Raster in form of a string or dimension object.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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..
param Tuple extents ( allow_None=False, constant=False, default=(None, None, None, None), instantiate=False, length=4, pickle_default_value=True, precedence=None, readonly=False )
Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.
clone ( data=None , shared_data=True , new_type=None , *args , **overrides )

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

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

closest ( coords )

Class method that returns the exact keys for a given list of coordinates. The supplied bounds defines the extent within which the samples are drawn and the optional shape argument is the shape of the numpy array (typically the shape of the .data attribute) when applicable.

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

Allows collapsing the data of a number of QuadMesh Elements with a function.

ddims

The list of deep dimensions

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

dimensions ( selection=u'all' , label=False )

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.

force_new_dynamic_value = <functools.partial object>
get_dimension ( dimension , default=None , strict=False )

Access a Dimension object by name or index. Returns the default value if the dimension is not found and strict is False. If strict is True, a KeyError is raised instead.

get_dimension_index ( dim )

Returns the index of the requested dimension.

get_dimension_type ( dim )

Returns the specified Dimension type if specified or if the dimension_values types are consistent otherwise None is returned.

get_param_values ( onlychanged=False )

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

get_value_generator = <functools.partial object>
hist ( dimension=None , num_bins=20 , bin_range=None , adjoin=True , individually=True , **kwargs )

The hist method generates a histogram to be adjoined to the Element in an AdjointLayout. By default the histogram is computed along the first value dimension of the Element, however any dimension may be selected. The number of bins and the bin_ranges and any kwargs to be passed to the histogram operation may also be supplied.

inspect_value = <functools.partial object>
map ( map_fn , specs=None , clone=True )

Recursively replaces elements using a map function when the specification applies.

matches ( spec )

A specification may be a class, a tuple or a string. Equivalent to isinstance if a class is supplied, otherwise matching occurs on type, group and label. These may be supplied as a tuple of strings or as a single string of the form “{type}.{group}.{label}”. Matching may be done on {type} alone, {type}.{group}, or {type}.{group}.{label}. The strings for the type, group, and label will each be sanitized before the match, and so the sanitized versions of those values will need to be provided if the match is to succeed.

message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

opts ( options=None , **kwargs )

Apply the supplied options to a clone of the object which is then returned. Note that if no options are supplied at all, all ids are reset.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

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

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

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

reduce ( dimensions=None , function=None , **reduce_map )

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

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

Assign a new label and/or group to an existing LabelledData object, creating a clone of the object with the new settings.

sample ( samples=[] , **sample_values )

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

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

Variant of __repr__ designed for generating a runnable script.

select ( selection_specs=None , **kwargs )

Allows slicing or indexing into the Dimensioned object by supplying the dimension and index/slice as key value pairs. Select descends recursively through the data structure applying the key dimension selection. The ‘value’ keyword allows selecting the value dimensions on objects which have any declared.

The selection may also be selectively applied to specific objects by supplying the selection_specs as an iterable of type.group.label specs, types or functions.

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object>
set_param = <functools.partial object>
state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

table ( datatype=None )

Converts the data Element to a Table, optionally may specify a supported data type. The default data types are ‘numpy’ (for homogeneous data), ‘dataframe’, and ‘dictionary’.

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

Traverses any nested LabelledData object (i.e LabelledData objects containing LabelledData objects), applying the supplied function to each constituent element if the supplied specifications. The output of these function calls are collected and returned in the accumulator list.

If specs is None, all constituent elements are processed. Otherwise, specs must be a list of type.group.label specs, types, and functions.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

class holoviews.element. Dataset ( data , **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.

param List vdims ( allow_None=False, bounds=(0, None), constant=True, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=Element, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
A string describing the data wrapped by the object.
param List datatype ( allow_None=False, bounds=(0, None), constant=False, default=[‘array’, ‘dataframe’, ‘dictionary’, ‘grid’, ‘ndelement’, ‘cube’, ‘xarray’, ‘dask’], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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).
param List kdims ( allow_None=False, bounds=(0, None), constant=True, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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..
add_dimension ( dimension , dim_pos , dim_val , vdim=False , **kwargs ) [source]

Create a new object with an additional key dimensions. 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.

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

Aggregates over the supplied key dimensions with the defined function.

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

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

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

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

Given a single coordinate or multiple coordinates as a tuple or list of tuples or keyword arguments matching the dimension closest will find the closest actual x/y coordinates. Different Element types should implement this appropriately depending on the space they represent, if the Element does not support snapping raise NotImplementedError.

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

Class method to collapse a list of data matching the data format of the Element type. By implementing this method HoloMap can collapse multiple Elements of the same type. The kwargs are passed to the collapse function. The collapse function must support the numpy style axis selection. Valid function include: np.mean, np.sum, np.product, np.std, scipy.stats.kurtosis etc. Some data backends also require the key dimensions to aggregate over.

ddims

The list of deep dimensions

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

dframe ( dimensions=None ) [source]

Returns the data in the form of a DataFrame. Supplying a list of dimensions filters the dataframe. If the data is already a DataFrame a copy is returned.

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

Returns the values along a particular dimension. If unique values are requested will return only unique values.

dimensions ( selection=u'all' , label=False )

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.

force_new_dynamic_value = <functools.partial object>
get_dimension ( dimension , default=None , strict=False )

Access a Dimension object by name or index. Returns the default value if the dimension is not found and strict is False. If strict is True, a KeyError is raised instead.

get_dimension_index ( dim )

Returns the index of the requested dimension.

get_dimension_type ( dim ) [source]

Returns the specified Dimension type if specified or if the dimension_values types are consistent otherwise None is returned.

get_param_values ( onlychanged=False )

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

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

Return the results of a groupby operation over the specified dimensions as an object of type container_type (expected to be dictionary-like).

Keys vary over the columns (dimensions) and the corresponding values are collections of group_type (e.g an Element, list, tuple) constructed with kwargs (if supplied).

If dynamic is requested container_type is automatically set to a DynamicMap, allowing dynamic exploration of large datasets. If the data does not represent a full cartesian grid of the requested dimensions some Elements will be empty.

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

The hist method generates a histogram to be adjoined to the Element in an AdjointLayout. By default the histogram is computed along the first value dimension of the Element, however any dimension may be selected. The number of bins and the bin_ranges and any kwargs to be passed to the histogram operation may also be supplied.

iloc

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]]

inspect_value = <functools.partial object>
map ( map_fn , specs=None , clone=True )

Recursively replaces elements using a map function when the specification applies.

matches ( spec )

A specification may be a class, a tuple or a string. Equivalent to isinstance if a class is supplied, otherwise matching occurs on type, group and label. These may be supplied as a tuple of strings or as a single string of the form “{type}.{group}.{label}”. Matching may be done on {type} alone, {type}.{group}, or {type}.{group}.{label}. The strings for the type, group, and label will each be sanitized before the match, and so the sanitized versions of those values will need to be provided if the match is to succeed.

message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

ndloc

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]]

opts ( options=None , **kwargs )

Apply the supplied options to a clone of the object which is then returned. Note that if no options are supplied at all, all ids are reset.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

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

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

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

range ( dim , data_range=True ) [source]

Computes the range of values along a supplied dimension, taking into account the range and soft_range defined on the Dimension object.

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

Allows reducing the values along one or more key dimension with the supplied function. The dimensions may be supplied as a list and a function to apply or a mapping between the dimensions and functions to apply along each dimension.

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

Create a new object with a re-ordered set of dimensions. Allows converting key dimensions to value dimensions and vice versa.

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

Assign a new label and/or group to an existing LabelledData object, creating a clone of the object with the new settings.

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

Allows sampling of Dataset as an iterator of coordinates matching the key dimensions, returning a new object containing just the selected samples. Alternatively may supply kwargs to sample a coordinate on an object. By default it will attempt to snap to the nearest coordinate if the Element supports it, snapping may be disabled with the closest argument.

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

Variant of __repr__ designed for generating a runnable script.

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

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

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object>
set_param = <functools.partial object>
shape

Returns the shape of the data.

sort ( by=[] ) [source]

Sorts the data by the values along the supplied dimensions.

state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

table ( datatype=None )

Converts the data Element to a Table, optionally may specify a supported data type. The default data types are ‘numpy’ (for homogeneous data), ‘dataframe’, and ‘dictionary’.

to

Property to create a conversion interface with methods to convert to other Element types.

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

Traverses any nested LabelledData object (i.e LabelledData objects containing LabelledData objects), applying the supplied function to each constituent element if the supplied specifications. The output of these function calls are collected and returned in the accumulator list.

If specs is None, all constituent elements are processed. Otherwise, specs must be a list of type.group.label specs, types, and functions.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

class holoviews.element. Chart ( data , **kwargs ) [source]

Bases: holoviews.core.data.Dataset , holoviews.core.element.Element2D

The data held within Chart is a numpy array of shape (N, D), where N is the number of samples and D the number of dimensions. Chart Elements are sliceable along up to two key dimensions. The data may be supplied in one of three formats:

  1. As a numpy array of shape (N, D).
  2. As a list of length N containing tuples of length D.
  3. As a tuple of length D containing iterables of length N.
param List vdims ( allow_None=False, bounds=(1, None), constant=False, default=[Dimension(‘y’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The value dimensions of the Chart, usually corresponding to a number of dependent variables.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=Chart, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
A string describing the data wrapped by the object.
param List datatype ( allow_None=False, bounds=(0, None), constant=False, default=[‘array’, ‘dataframe’, ‘dictionary’, ‘grid’, ‘ndelement’, ‘cube’, ‘xarray’, ‘dask’], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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).
param List kdims ( allow_None=False, bounds=(1, 2), constant=False, default=[Dimension(‘x’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The key dimensions of the Chart, determining the number of indexable dimensions.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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..
param Tuple extents ( allow_None=False, constant=False, default=(None, None, None, None), instantiate=False, length=4, pickle_default_value=True, precedence=None, readonly=False )
Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.
add_dimension ( dimension , dim_pos , dim_val , vdim=False , **kwargs )

Create a new object with an additional key dimensions. 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.

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

Aggregates over the supplied key dimensions with the defined function.

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

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

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

closest ( coords=[] , **kwargs )

Given a single coordinate or multiple coordinates as a tuple or list of tuples or keyword arguments matching the dimension closest will find the closest actual x/y coordinates. Different Element types should implement this appropriately depending on the space they represent, if the Element does not support snapping raise NotImplementedError.

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

Class method to collapse a list of data matching the data format of the Element type. By implementing this method HoloMap can collapse multiple Elements of the same type. The kwargs are passed to the collapse function. The collapse function must support the numpy style axis selection. Valid function include: np.mean, np.sum, np.product, np.std, scipy.stats.kurtosis etc. Some data backends also require the key dimensions to aggregate over.

ddims

The list of deep dimensions

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

dframe ( dimensions=None )

Returns the data in the form of a DataFrame. Supplying a list of dimensions filters the dataframe. If the data is already a DataFrame a copy is returned.

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

Returns the values along a particular dimension. If unique values are requested will return only unique values.

dimensions ( selection=u'all' , label=False )

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.

force_new_dynamic_value = <functools.partial object>
get_dimension ( dimension , default=None , strict=False )

Access a Dimension object by name or index. Returns the default value if the dimension is not found and strict is False. If strict is True, a KeyError is raised instead.

get_dimension_index ( dim )

Returns the index of the requested dimension.

get_dimension_type ( dim )

Returns the specified Dimension type if specified or if the dimension_values types are consistent otherwise None is returned.

get_param_values ( onlychanged=False )

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

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

Return the results of a groupby operation over the specified dimensions as an object of type container_type (expected to be dictionary-like).

Keys vary over the columns (dimensions) and the corresponding values are collections of group_type (e.g an Element, list, tuple) constructed with kwargs (if supplied).

If dynamic is requested container_type is automatically set to a DynamicMap, allowing dynamic exploration of large datasets. If the data does not represent a full cartesian grid of the requested dimensions some Elements will be empty.

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

The hist method generates a histogram to be adjoined to the Element in an AdjointLayout. By default the histogram is computed along the first value dimension of the Element, however any dimension may be selected. The number of bins and the bin_ranges and any kwargs to be passed to the histogram operation may also be supplied.

iloc

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]]

inspect_value = <functools.partial object>
map ( map_fn , specs=None , clone=True )

Recursively replaces elements using a map function when the specification applies.

matches ( spec )

A specification may be a class, a tuple or a string. Equivalent to isinstance if a class is supplied, otherwise matching occurs on type, group and label. These may be supplied as a tuple of strings or as a single string of the form “{type}.{group}.{label}”. Matching may be done on {type} alone, {type}.{group}, or {type}.{group}.{label}. The strings for the type, group, and label will each be sanitized before the match, and so the sanitized versions of those values will need to be provided if the match is to succeed.

message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

ndloc

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]]

opts ( options=None , **kwargs )

Apply the supplied options to a clone of the object which is then returned. Note that if no options are supplied at all, all ids are reset.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

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

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

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

range ( dim , data_range=True )

Computes the range of values along a supplied dimension, taking into account the range and soft_range defined on the Dimension object.

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

Allows reducing the values along one or more key dimension with the supplied function. The dimensions may be supplied as a list and a function to apply or a mapping between the dimensions and functions to apply along each dimension.

reindex ( kdims=None , vdims=None )

Create a new object with a re-ordered set of dimensions. Allows converting key dimensions to value dimensions and vice versa.

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

Assign a new label and/or group to an existing LabelledData object, creating a clone of the object with the new settings.

sample ( samples=[] , closest=True , **kwargs )

Allows sampling of Dataset as an iterator of coordinates matching the key dimensions, returning a new object containing just the selected samples. Alternatively may supply kwargs to sample a coordinate on an object. By default it will attempt to snap to the nearest coordinate if the Element supports it, snapping may be disabled with the closest argument.

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

Variant of __repr__ designed for generating a runnable script.

select ( selection_specs=None , **selection )

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

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object>
set_param = <functools.partial object>
shape

Returns the shape of the data.

sort ( by=[] )

Sorts the data by the values along the supplied dimensions.

state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

table ( datatype=None )

Converts the data Element to a Table, optionally may specify a supported data type. The default data types are ‘numpy’ (for homogeneous data), ‘dataframe’, and ‘dictionary’.

to

Property to create a conversion interface with methods to convert to other Element types.

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

Traverses any nested LabelledData object (i.e LabelledData objects containing LabelledData objects), applying the supplied function to each constituent element if the supplied specifications. The output of these function calls are collected and returned in the accumulator list.

If specs is None, all constituent elements are processed. Otherwise, specs must be a list of type.group.label specs, types, and functions.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

class holoviews.element. Histogram ( values , edges=None , **params ) [source]

Bases: holoviews.core.element.Element2D

Histogram contains a number of bins, which are defined by the upper and lower bounds of their edges and the computed bin values.

param List vdims ( allow_None=False, bounds=(1, 1), constant=False, default=[Dimension(‘Frequency’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=Histogram, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
A string describing the data wrapped by the object.
param List kdims ( allow_None=False, bounds=(1, 1), constant=False, default=[Dimension(‘x’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
Dimensions on Element2Ds determine the number of indexable dimensions.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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..
param Tuple extents ( allow_None=False, constant=False, default=(None, None, None, None), instantiate=False, length=4, pickle_default_value=True, precedence=None, readonly=False )
Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.
clone ( data=None , shared_data=True , new_type=None , *args , **overrides )

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

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

closest ( coords )

Class method that returns the exact keys for a given list of coordinates. The supplied bounds defines the extent within which the samples are drawn and the optional shape argument is the shape of the numpy array (typically the shape of the .data attribute) when applicable.

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

Class method to collapse a list of data matching the data format of the Element type. By implementing this method HoloMap can collapse multiple Elements of the same type. The kwargs are passed to the collapse function. The collapse function must support the numpy style axis selection. Valid function include: np.mean, np.sum, np.product, np.std, scipy.stats.kurtosis etc. Some data backends also require the key dimensions to aggregate over.

ddims

The list of deep dimensions

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

dimensions ( selection=u'all' , label=False )

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.

force_new_dynamic_value = <functools.partial object>
get_dimension ( dimension , default=None , strict=False )

Access a Dimension object by name or index. Returns the default value if the dimension is not found and strict is False. If strict is True, a KeyError is raised instead.

get_dimension_index ( dim )

Returns the index of the requested dimension.

get_dimension_type ( dim )

Returns the specified Dimension type if specified or if the dimension_values types are consistent otherwise None is returned.

get_param_values ( onlychanged=False )

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

get_value_generator = <functools.partial object>
hist ( dimension=None , num_bins=20 , bin_range=None , adjoin=True , individually=True , **kwargs )

The hist method generates a histogram to be adjoined to the Element in an AdjointLayout. By default the histogram is computed along the first value dimension of the Element, however any dimension may be selected. The number of bins and the bin_ranges and any kwargs to be passed to the histogram operation may also be supplied.

inspect_value = <functools.partial object>
map ( map_fn , specs=None , clone=True )

Recursively replaces elements using a map function when the specification applies.

matches ( spec )

A specification may be a class, a tuple or a string. Equivalent to isinstance if a class is supplied, otherwise matching occurs on type, group and label. These may be supplied as a tuple of strings or as a single string of the form “{type}.{group}.{label}”. Matching may be done on {type} alone, {type}.{group}, or {type}.{group}.{label}. The strings for the type, group, and label will each be sanitized before the match, and so the sanitized versions of those values will need to be provided if the match is to succeed.

message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

opts ( options=None , **kwargs )

Apply the supplied options to a clone of the object which is then returned. Note that if no options are supplied at all, all ids are reset.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

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

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

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

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

Assign a new label and/or group to an existing LabelledData object, creating a clone of the object with the new settings.

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

Variant of __repr__ designed for generating a runnable script.

select ( selection_specs=None , **kwargs )

Allows slicing or indexing into the Dimensioned object by supplying the dimension and index/slice as key value pairs. Select descends recursively through the data structure applying the key dimension selection. The ‘value’ keyword allows selecting the value dimensions on objects which have any declared.

The selection may also be selectively applied to specific objects by supplying the selection_specs as an iterable of type.group.label specs, types or functions.

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object>
set_param = <functools.partial object>
state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

table ( datatype=None )

Converts the data Element to a Table, optionally may specify a supported data type. The default data types are ‘numpy’ (for homogeneous data), ‘dataframe’, and ‘dictionary’.

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

Traverses any nested LabelledData object (i.e LabelledData objects containing LabelledData objects), applying the supplied function to each constituent element if the supplied specifications. The output of these function calls are collected and returned in the accumulator list.

If specs is None, all constituent elements are processed. Otherwise, specs must be a list of type.group.label specs, types, and functions.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

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

Bases: holoviews.core.data.Dataset , holoviews.core.element.Element2D

HeatMap is an atomic Element used to visualize two dimensional parameter spaces. It supports sparse or non-linear spaces, dynamically upsampling them to a dense representation, which can be visualized.

A HeatMap can be initialized with any dict or NdMapping type with two-dimensional keys.

param List vdims ( allow_None=False, bounds=(0, None), constant=False, default=[Dimension(‘z’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=HeatMap, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
A string describing the data wrapped by the object.
param List datatype ( allow_None=False, bounds=(0, None), constant=False, default=[‘array’, ‘dataframe’, ‘dictionary’, ‘grid’, ‘ndelement’, ‘cube’, ‘xarray’, ‘dask’], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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).
param List kdims ( allow_None=False, bounds=(0, None), constant=False, default=[Dimension(‘x’), Dimension(‘y’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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..
param Tuple extents ( allow_None=False, constant=False, default=(None, None, None, None), instantiate=False, length=4, pickle_default_value=True, precedence=None, readonly=False )
Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.
add_dimension ( dimension , dim_pos , dim_val , vdim=False , **kwargs )

Create a new object with an additional key dimensions. 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.

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

Aggregates over the supplied key dimensions with the defined function.

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

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

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

closest ( coords=[] , **kwargs )

Given a single coordinate or multiple coordinates as a tuple or list of tuples or keyword arguments matching the dimension closest will find the closest actual x/y coordinates. Different Element types should implement this appropriately depending on the space they represent, if the Element does not support snapping raise NotImplementedError.

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

Class method to collapse a list of data matching the data format of the Element type. By implementing this method HoloMap can collapse multiple Elements of the same type. The kwargs are passed to the collapse function. The collapse function must support the numpy style axis selection. Valid function include: np.mean, np.sum, np.product, np.std, scipy.stats.kurtosis etc. Some data backends also require the key dimensions to aggregate over.

ddims

The list of deep dimensions

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

dframe ( dimensions=None )

Returns the data in the form of a DataFrame. Supplying a list of dimensions filters the dataframe. If the data is already a DataFrame a copy is returned.

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

Returns the values along a particular dimension. If unique values are requested will return only unique values.

dimensions ( selection=u'all' , label=False )

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.

force_new_dynamic_value = <functools.partial object>
get_dimension ( dimension , default=None , strict=False )

Access a Dimension object by name or index. Returns the default value if the dimension is not found and strict is False. If strict is True, a KeyError is raised instead.

get_dimension_index ( dim )

Returns the index of the requested dimension.

get_dimension_type ( dim )

Returns the specified Dimension type if specified or if the dimension_values types are consistent otherwise None is returned.

get_param_values ( onlychanged=False )

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

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

Return the results of a groupby operation over the specified dimensions as an object of type container_type (expected to be dictionary-like).

Keys vary over the columns (dimensions) and the corresponding values are collections of group_type (e.g an Element, list, tuple) constructed with kwargs (if supplied).

If dynamic is requested container_type is automatically set to a DynamicMap, allowing dynamic exploration of large datasets. If the data does not represent a full cartesian grid of the requested dimensions some Elements will be empty.

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

The hist method generates a histogram to be adjoined to the Element in an AdjointLayout. By default the histogram is computed along the first value dimension of the Element, however any dimension may be selected. The number of bins and the bin_ranges and any kwargs to be passed to the histogram operation may also be supplied.

iloc

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]]

inspect_value = <functools.partial object>
map ( map_fn , specs=None , clone=True )

Recursively replaces elements using a map function when the specification applies.

matches ( spec )

A specification may be a class, a tuple or a string. Equivalent to isinstance if a class is supplied, otherwise matching occurs on type, group and label. These may be supplied as a tuple of strings or as a single string of the form “{type}.{group}.{label}”. Matching may be done on {type} alone, {type}.{group}, or {type}.{group}.{label}. The strings for the type, group, and label will each be sanitized before the match, and so the sanitized versions of those values will need to be provided if the match is to succeed.

message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

ndloc

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]]

opts ( options=None , **kwargs )

Apply the supplied options to a clone of the object which is then returned. Note that if no options are supplied at all, all ids are reset.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

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

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

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

range ( dim , data_range=True )

Computes the range of values along a supplied dimension, taking into account the range and soft_range defined on the Dimension object.

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

Allows reducing the values along one or more key dimension with the supplied function. The dimensions may be supplied as a list and a function to apply or a mapping between the dimensions and functions to apply along each dimension.

reindex ( kdims=None , vdims=None )

Create a new object with a re-ordered set of dimensions. Allows converting key dimensions to value dimensions and vice versa.

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

Assign a new label and/or group to an existing LabelledData object, creating a clone of the object with the new settings.

sample ( samples=[] , closest=True , **kwargs )

Allows sampling of Dataset as an iterator of coordinates matching the key dimensions, returning a new object containing just the selected samples. Alternatively may supply kwargs to sample a coordinate on an object. By default it will attempt to snap to the nearest coordinate if the Element supports it, snapping may be disabled with the closest argument.

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

Variant of __repr__ designed for generating a runnable script.

select ( selection_specs=None , **selection )

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

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object>
set_param = <functools.partial object>
shape

Returns the shape of the data.

sort ( by=[] )

Sorts the data by the values along the supplied dimensions.

state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

table ( datatype=None )

Converts the data Element to a Table, optionally may specify a supported data type. The default data types are ‘numpy’ (for homogeneous data), ‘dataframe’, and ‘dictionary’.

to

Property to create a conversion interface with methods to convert to other Element types.

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

Traverses any nested LabelledData object (i.e LabelledData objects containing LabelledData objects), applying the supplied function to each constituent element if the supplied specifications. The output of these function calls are collected and returned in the accumulator list.

If specs is None, all constituent elements are processed. Otherwise, specs must be a list of type.group.label specs, types, and functions.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

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

Bases: holoviews.element.raster.RGB

Example of a commonly used color space subclassed from RGB used for working in a HSV (hue, saturation and value) color space.

param List vdims ( allow_None=False, bounds=(3, 4), constant=False, default=[Dimension(‘H’), Dimension(‘S’), Dimension(‘V’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The dimension description of the data held in the array. If an alpha channel is supplied, the defined alpha_dimension is automatically appended to this list.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=HSV, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
A string describing the data wrapped by the object.
param List datatype ( allow_None=False, bounds=(0, None), constant=False, default=[‘image’, ‘grid’, ‘xarray’, ‘cube’, ‘dataframe’, ‘dictionary’], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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).
param List kdims ( allow_None=False, bounds=(2, 2), constant=True, default=[Dimension(‘x’), Dimension(‘y’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The label of the x- and y-dimension of the Raster in form of a string or dimension object.
param ClassSelector bounds ( allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The bounding region in sheet coordinates containing the data.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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..
param ClassSelector alpha_dimension ( allow_None=False, constant=False, default=A, instantiate=False, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The alpha dimension definition to add the value dimensions if an alpha channel is supplied.
param Tuple extents ( allow_None=False, constant=False, default=(None, None, None, None), instantiate=False, length=4, pickle_default_value=True, precedence=None, readonly=False )
Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.
add_dimension ( dimension , dim_pos , dim_val , vdim=False , **kwargs )

Create a new object with an additional key dimensions. 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.

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

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

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

closest ( coords=[] , **kwargs )

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

closest_cell_center ( x , y )

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

ddims

The list of deep dimensions

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

dframe ( dimensions=None )

Returns the data in the form of a DataFrame. Supplying a list of dimensions filters the dataframe. If the data is already a DataFrame a copy is returned.

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

Returns the values along a particular dimension. If unique values are requested will return only unique values.

dimensions ( selection=u'all' , label=False )

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.

force_new_dynamic_value = <functools.partial object>
get_dimension ( dimension , default=None , strict=False )

Access a Dimension object by name or index. Returns the default value if the dimension is not found and strict is False. If strict is True, a KeyError is raised instead.

get_dimension_index ( dim )

Returns the index of the requested dimension.

get_dimension_type ( dim )

Returns the specified Dimension type if specified or if the dimension_values types are consistent otherwise None is returned.

get_param_values ( onlychanged=False )

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

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

Return the results of a groupby operation over the specified dimensions as an object of type container_type (expected to be dictionary-like).

Keys vary over the columns (dimensions) and the corresponding values are collections of group_type (e.g an Element, list, tuple) constructed with kwargs (if supplied).

If dynamic is requested container_type is automatically set to a DynamicMap, allowing dynamic exploration of large datasets. If the data does not represent a full cartesian grid of the requested dimensions some Elements will be empty.

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

The hist method generates a histogram to be adjoined to the Element in an AdjointLayout. By default the histogram is computed along the first value dimension of the Element, however any dimension may be selected. The number of bins and the bin_ranges and any kwargs to be passed to the histogram operation may also be supplied.

iloc

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]]

inspect_value = <functools.partial object>
load_image ( filename , height=1 , array=False , bounds=None , bare=False , **kwargs )

Returns an raster element or raw numpy array from a PNG image file, using matplotlib.

The specified height determines the bounds of the raster object in sheet coordinates: by default the height is 1 unit with the width scaled appropriately by the image aspect ratio.

Note that as PNG images are encoded as RGBA, the red component maps to the first channel, the green component maps to the second component etc. For RGB elements, this mapping is trivial but may be important for subclasses e.g. for HSV elements.

Setting bare=True will apply options disabling axis labels displaying just the bare image. Any additional keyword arguments will be passed to the Image object.

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

Recursively replaces elements using a map function when the specification applies.

matches ( spec )

A specification may be a class, a tuple or a string. Equivalent to isinstance if a class is supplied, otherwise matching occurs on type, group and label. These may be supplied as a tuple of strings or as a single string of the form “{type}.{group}.{label}”. Matching may be done on {type} alone, {type}.{group}, or {type}.{group}.{label}. The strings for the type, group, and label will each be sanitized before the match, and so the sanitized versions of those values will need to be provided if the match is to succeed.

matrix2sheet ( float_row , float_col )

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 )

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.

message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

ndloc

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]]

opts ( options=None , **kwargs )

Apply the supplied options to a clone of the object which is then returned. Note that if no options are supplied at all, all ids are reset.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

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

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

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

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

Allows reducing the values along one or more key dimension with the supplied function. The dimensions may be supplied as a list and a function to apply or a mapping between the dimensions and functions to apply along each dimension.

reindex ( kdims=None , vdims=None )

Create a new object with a re-ordered set of dimensions. Allows converting key dimensions to value dimensions and vice versa.

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

Assign a new label and/or group to an existing LabelledData object, creating a clone of the object with the new settings.

rgb

Conversion from HSV to RGB.

sample ( samples=[] , **kwargs )

Allows sampling of an Image as an iterator of coordinates matching the key dimensions, returning a new object containing just the selected samples. Alternatively may supply kwargs to sample a coordinate on an object. On an Image the coordinates are continuously indexed and will always snap to the nearest coordinate.

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

Variant of __repr__ designed for generating a runnable script.

select ( selection_specs=None , **selection )

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

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object>
set_param = <functools.partial object>
shape

Returns the shape of the data.

sheet2matrix ( x , y )

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 )

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

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.

sort ( by=[] )

Sorts the data by the values along the supplied dimensions.

state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

table ( datatype=None )

Converts the data Element to a Table, optionally may specify a supported data type. The default data types are ‘numpy’ (for homogeneous data), ‘dataframe’, and ‘dictionary’.

to

Property to create a conversion interface with methods to convert to other Element types.

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

Traverses any nested LabelledData object (i.e LabelledData objects containing LabelledData objects), applying the supplied function to each constituent element if the supplied specifications. The output of these function calls are collected and returned in the accumulator list.

If specs is None, all constituent elements are processed. Otherwise, specs must be a list of type.group.label specs, types, and functions.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

xdensity

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

ydensity

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

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

Bases: holoviews.core.element.Element2D

The Path Element contains a list of Paths stored as Nx2 numpy arrays. The data may be supplied in one of the following ways:

  1. A list of Nx2 numpy arrays.
  2. A list of lists containing x/y coordinate tuples.
  3. A tuple containing an array of length N with the x-values and a second array of shape NxP, where P is the number of paths.
  4. A list of tuples each containing separate x and y values.
param List vdims ( allow_None=False, bounds=(0, None), constant=True, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=Path, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
A string describing the data wrapped by the object.
param List kdims ( allow_None=False, bounds=(2, 2), constant=True, default=[Dimension(‘x’), Dimension(‘y’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The label of the x- and y-dimension of the Image in form of a string or dimension object.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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..
param Tuple extents ( allow_None=False, constant=False, default=(None, None, None, None), instantiate=False, length=4, pickle_default_value=True, precedence=None, readonly=False )
Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.
clone ( data=None , shared_data=True , new_type=None , *args , **overrides )

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

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

closest ( coords )

Class method that returns the exact keys for a given list of coordinates. The supplied bounds defines the extent within which the samples are drawn and the optional shape argument is the shape of the numpy array (typically the shape of the .data attribute) when applicable.

ddims

The list of deep dimensions

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

dimensions ( selection=u'all' , label=False )

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.

force_new_dynamic_value = <functools.partial object>
get_dimension ( dimension , default=None , strict=False )

Access a Dimension object by name or index. Returns the default value if the dimension is not found and strict is False. If strict is True, a KeyError is raised instead.

get_dimension_index ( dim )

Returns the index of the requested dimension.

get_dimension_type ( dim )

Returns the specified Dimension type if specified or if the dimension_values types are consistent otherwise None is returned.

get_param_values ( onlychanged=False )

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

get_value_generator = <functools.partial object>
hist ( dimension=None , num_bins=20 , bin_range=None , adjoin=True , individually=True , **kwargs )

The hist method generates a histogram to be adjoined to the Element in an AdjointLayout. By default the histogram is computed along the first value dimension of the Element, however any dimension may be selected. The number of bins and the bin_ranges and any kwargs to be passed to the histogram operation may also be supplied.

inspect_value = <functools.partial object>
map ( map_fn , specs=None , clone=True )

Recursively replaces elements using a map function when the specification applies.

matches ( spec )

A specification may be a class, a tuple or a string. Equivalent to isinstance if a class is supplied, otherwise matching occurs on type, group and label. These may be supplied as a tuple of strings or as a single string of the form “{type}.{group}.{label}”. Matching may be done on {type} alone, {type}.{group}, or {type}.{group}.{label}. The strings for the type, group, and label will each be sanitized before the match, and so the sanitized versions of those values will need to be provided if the match is to succeed.

message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

opts ( options=None , **kwargs )

Apply the supplied options to a clone of the object which is then returned. Note that if no options are supplied at all, all ids are reset.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

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

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

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

range ( dimension , data_range=True )

Returns the range of values along the specified dimension.

If data_range is True, the data may be used to try and infer the appropriate range. Otherwise, (None,None) is returned to indicate that no range is defined.

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

Base class signature to demonstrate API for reducing Elements, using some reduce function, e.g. np.mean, which is applied along a particular Dimension. The dimensions and reduce functions should be passed as keyword arguments or as a list of dimensions and a single function.

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

Assign a new label and/or group to an existing LabelledData object, creating a clone of the object with the new settings.

sample ( samples=[] , **sample_values )

Base class signature to demonstrate API for sampling Elements. To sample an Element supply either a list of sampels or keyword arguments, where the key should match an existing key dimension on the Element.

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

Variant of __repr__ designed for generating a runnable script.

select ( selection_specs=None , **kwargs )

Allows slicing or indexing into the Dimensioned object by supplying the dimension and index/slice as key value pairs. Select descends recursively through the data structure applying the key dimension selection. The ‘value’ keyword allows selecting the value dimensions on objects which have any declared.

The selection may also be selectively applied to specific objects by supplying the selection_specs as an iterable of type.group.label specs, types or functions.

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object>
set_param = <functools.partial object>
state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

table ( datatype=None )

Converts the data Element to a Table, optionally may specify a supported data type. The default data types are ‘numpy’ (for homogeneous data), ‘dataframe’, and ‘dictionary’.

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

Traverses any nested LabelledData object (i.e LabelledData objects containing LabelledData objects), applying the supplied function to each constituent element if the supplied specifications. The output of these function calls are collected and returned in the accumulator list.

If specs is None, all constituent elements are processed. Otherwise, specs must be a list of type.group.label specs, types, and functions.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

class holoviews.element. Scatter3D ( data , **kwargs ) [source]

Bases: holoviews.core.element.Element3D , holoviews.element.chart.Scatter

Scatter3D object represents a number of coordinates in 3D-space. Additionally Scatter3D points may have any number of value dimensions. The data may therefore be supplied as NxD matrix where N represents the number of samples, and D the number of key and value dimensions.

param List vdims ( allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
Scatter3D can have optional value dimensions, which may be mapped onto color and size.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=Scatter3D, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
A string describing the data wrapped by the object.
param List datatype ( allow_None=False, bounds=(0, None), constant=False, default=[‘array’, ‘dataframe’, ‘dictionary’, ‘grid’, ‘ndelement’, ‘cube’, ‘xarray’, ‘dask’], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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).
param List kdims ( allow_None=False, bounds=(0, None), constant=False, default=[Dimension(‘x’), Dimension(‘y’), Dimension(‘z’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The key dimensions of the Chart, determining the number of indexable dimensions.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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..
param Tuple extents ( allow_None=False, constant=False, default=(None, None, None, None, None, None), instantiate=False, length=6, pickle_default_value=True, precedence=None, readonly=False )
Allows overriding the extents of the Element in 3D space defined as (xmin, ymin, zmin, xmax, ymax, zmax).
add_dimension ( dimension , dim_pos , dim_val , vdim=False , **kwargs )

Create a new object with an additional key dimensions. 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.

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

Aggregates over the supplied key dimensions with the defined function.

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

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

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

closest ( coords=[] , **kwargs )

Given a single coordinate or multiple coordinates as a tuple or list of tuples or keyword arguments matching the dimension closest will find the closest actual x/y coordinates. Different Element types should implement this appropriately depending on the space they represent, if the Element does not support snapping raise NotImplementedError.

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

Class method to collapse a list of data matching the data format of the Element type. By implementing this method HoloMap can collapse multiple Elements of the same type. The kwargs are passed to the collapse function. The collapse function must support the numpy style axis selection. Valid function include: np.mean, np.sum, np.product, np.std, scipy.stats.kurtosis etc. Some data backends also require the key dimensions to aggregate over.

ddims

The list of deep dimensions

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

dframe ( dimensions=None )

Returns the data in the form of a DataFrame. Supplying a list of dimensions filters the dataframe. If the data is already a DataFrame a copy is returned.

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

Returns the values along a particular dimension. If unique values are requested will return only unique values.

dimensions ( selection=u'all' , label=False )

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.

force_new_dynamic_value = <functools.partial object>
get_dimension ( dimension , default=None , strict=False )

Access a Dimension object by name or index. Returns the default value if the dimension is not found and strict is False. If strict is True, a KeyError is raised instead.

get_dimension_index ( dim )

Returns the index of the requested dimension.

get_dimension_type ( dim )

Returns the specified Dimension type if specified or if the dimension_values types are consistent otherwise None is returned.

get_param_values ( onlychanged=False )

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

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

Return the results of a groupby operation over the specified dimensions as an object of type container_type (expected to be dictionary-like).

Keys vary over the columns (dimensions) and the corresponding values are collections of group_type (e.g an Element, list, tuple) constructed with kwargs (if supplied).

If dynamic is requested container_type is automatically set to a DynamicMap, allowing dynamic exploration of large datasets. If the data does not represent a full cartesian grid of the requested dimensions some Elements will be empty.

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

The hist method generates a histogram to be adjoined to the Element in an AdjointLayout. By default the histogram is computed along the first value dimension of the Element, however any dimension may be selected. The number of bins and the bin_ranges and any kwargs to be passed to the histogram operation may also be supplied.

iloc

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]]

inspect_value = <functools.partial object>
map ( map_fn , specs=None , clone=True )

Recursively replaces elements using a map function when the specification applies.

matches ( spec )

A specification may be a class, a tuple or a string. Equivalent to isinstance if a class is supplied, otherwise matching occurs on type, group and label. These may be supplied as a tuple of strings or as a single string of the form “{type}.{group}.{label}”. Matching may be done on {type} alone, {type}.{group}, or {type}.{group}.{label}. The strings for the type, group, and label will each be sanitized before the match, and so the sanitized versions of those values will need to be provided if the match is to succeed.

message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

ndloc

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]]

opts ( options=None , **kwargs )

Apply the supplied options to a clone of the object which is then returned. Note that if no options are supplied at all, all ids are reset.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

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

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

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

range ( dim , data_range=True )

Computes the range of values along a supplied dimension, taking into account the range and soft_range defined on the Dimension object.

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

Allows reducing the values along one or more key dimension with the supplied function. The dimensions may be supplied as a list and a function to apply or a mapping between the dimensions and functions to apply along each dimension.

reindex ( kdims=None , vdims=None )

Create a new object with a re-ordered set of dimensions. Allows converting key dimensions to value dimensions and vice versa.

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

Assign a new label and/or group to an existing LabelledData object, creating a clone of the object with the new settings.

sample ( samples=[] , closest=True , **kwargs )

Allows sampling of Dataset as an iterator of coordinates matching the key dimensions, returning a new object containing just the selected samples. Alternatively may supply kwargs to sample a coordinate on an object. By default it will attempt to snap to the nearest coordinate if the Element supports it, snapping may be disabled with the closest argument.

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

Variant of __repr__ designed for generating a runnable script.

select ( selection_specs=None , **selection )

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

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object>
set_param = <functools.partial object>
shape

Returns the shape of the data.

sort ( by=[] )

Sorts the data by the values along the supplied dimensions.

state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

table ( datatype=None )

Converts the data Element to a Table, optionally may specify a supported data type. The default data types are ‘numpy’ (for homogeneous data), ‘dataframe’, and ‘dictionary’.

to

Property to create a conversion interface with methods to convert to other Element types.

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

Traverses any nested LabelledData object (i.e LabelledData objects containing LabelledData objects), applying the supplied function to each constituent element if the supplied specifications. The output of these function calls are collected and returned in the accumulator list.

If specs is None, all constituent elements are processed. Otherwise, specs must be a list of type.group.label specs, types, and functions.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

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

Bases: holoviews.core.element.Element2D

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

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

param List vdims ( allow_None=False, bounds=(0, None), constant=True, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=Annotation, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
A string describing the data wrapped by the object.
param List kdims ( allow_None=False, bounds=(2, 2), constant=False, default=[Dimension(‘x’), Dimension(‘y’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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..
param Tuple extents ( allow_None=False, constant=False, default=(None, None, None, None), instantiate=False, length=4, pickle_default_value=True, precedence=None, readonly=False )
Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.
closest ( coords )

Class method that returns the exact keys for a given list of coordinates. The supplied bounds defines the extent within which the samples are drawn and the optional shape argument is the shape of the numpy array (typically the shape of the .data attribute) when applicable.

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

Class method to collapse a list of data matching the data format of the Element type. By implementing this method HoloMap can collapse multiple Elements of the same type. The kwargs are passed to the collapse function. The collapse function must support the numpy style axis selection. Valid function include: np.mean, np.sum, np.product, np.std, scipy.stats.kurtosis etc. Some data backends also require the key dimensions to aggregate over.

ddims

The list of deep dimensions

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

dimensions ( selection=u'all' , label=False )

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.

force_new_dynamic_value = <functools.partial object>
get_dimension ( dimension , default=None , strict=False )

Access a Dimension object by name or index. Returns the default value if the dimension is not found and strict is False. If strict is True, a KeyError is raised instead.

get_dimension_index ( dim )

Returns the index of the requested dimension.

get_dimension_type ( dim )

Returns the specified Dimension type if specified or if the dimension_values types are consistent otherwise None is returned.

get_param_values ( onlychanged=False )

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

get_value_generator = <functools.partial object>
hist ( dimension=None , num_bins=20 , bin_range=None , adjoin=True , individually=True , **kwargs )

The hist method generates a histogram to be adjoined to the Element in an AdjointLayout. By default the histogram is computed along the first value dimension of the Element, however any dimension may be selected. The number of bins and the bin_ranges and any kwargs to be passed to the histogram operation may also be supplied.

inspect_value = <functools.partial object>
map ( map_fn , specs=None , clone=True )

Recursively replaces elements using a map function when the specification applies.

matches ( spec )

A specification may be a class, a tuple or a string. Equivalent to isinstance if a class is supplied, otherwise matching occurs on type, group and label. These may be supplied as a tuple of strings or as a single string of the form “{type}.{group}.{label}”. Matching may be done on {type} alone, {type}.{group}, or {type}.{group}.{label}. The strings for the type, group, and label will each be sanitized before the match, and so the sanitized versions of those values will need to be provided if the match is to succeed.

message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

opts ( options=None , **kwargs )

Apply the supplied options to a clone of the object which is then returned. Note that if no options are supplied at all, all ids are reset.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

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

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

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

range ( dimension , data_range=True )

Returns the range of values along the specified dimension.

If data_range is True, the data may be used to try and infer the appropriate range. Otherwise, (None,None) is returned to indicate that no range is defined.

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

Base class signature to demonstrate API for reducing Elements, using some reduce function, e.g. np.mean, which is applied along a particular Dimension. The dimensions and reduce functions should be passed as keyword arguments or as a list of dimensions and a single function.

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

Assign a new label and/or group to an existing LabelledData object, creating a clone of the object with the new settings.

sample ( samples=[] , **sample_values )

Base class signature to demonstrate API for sampling Elements. To sample an Element supply either a list of sampels or keyword arguments, where the key should match an existing key dimension on the Element.

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

Variant of __repr__ designed for generating a runnable script.

select ( selection_specs=None , **kwargs )

Allows slicing or indexing into the Dimensioned object by supplying the dimension and index/slice as key value pairs. Select descends recursively through the data structure applying the key dimension selection. The ‘value’ keyword allows selecting the value dimensions on objects which have any declared.

The selection may also be selectively applied to specific objects by supplying the selection_specs as an iterable of type.group.label specs, types or functions.

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object>
set_param = <functools.partial object>
state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

table ( datatype=None )

Converts the data Element to a Table, optionally may specify a supported data type. The default data types are ‘numpy’ (for homogeneous data), ‘dataframe’, and ‘dictionary’.

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

Traverses any nested LabelledData object (i.e LabelledData objects containing LabelledData objects), applying the supplied function to each constituent element if the supplied specifications. The output of these function calls are collected and returned in the accumulator list.

If specs is None, all constituent elements are processed. Otherwise, specs must be a list of type.group.label specs, types, and functions.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

class holoviews.element. Box ( x , y , spec , **params ) [source]

Bases: holoviews.element.path.BaseShape

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

param List vdims ( allow_None=False, bounds=(0, None), constant=True, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=Box, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The assigned group name.
param List kdims ( allow_None=False, bounds=(2, 2), constant=True, default=[Dimension(‘x’), Dimension(‘y’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The label of the x- and y-dimension of the Image in form of a string or dimension object.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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..
param Number width ( allow_None=False, bounds=None, constant=False, default=1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, softbounds=None, time_dependent=False, time_fn=<Time Time00001> )
The width of the box.
param Number aspect ( allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, softbounds=None, time_dependent=False, time_fn=<Time Time00001> )
Optional multiplier applied to the box size to compute the width in cases where only the length value is set.
param Number x ( allow_None=False, bounds=None, constant=False, default=0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, softbounds=None, time_dependent=False, time_fn=<Time Time00001> )
The x-position of the box center.
param Number y ( allow_None=False, bounds=None, constant=False, default=0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, softbounds=None, time_dependent=False, time_fn=<Time Time00001> )
The y-position of the box center.
param Tuple extents ( allow_None=False, constant=False, default=(None, None, None, None), instantiate=False, length=4, pickle_default_value=True, precedence=None, readonly=False )
Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.
param Number height ( allow_None=False, bounds=None, constant=False, default=1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, softbounds=None, time_dependent=False, time_fn=<Time Time00001> )
The height of the box.
param Number orientation ( allow_None=False, bounds=None, constant=False, default=0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, softbounds=None, time_dependent=False, time_fn=<Time Time00001> )
Orientation in the Cartesian coordinate system, the counterclockwise angle in radians between the first axis and the horizontal.
clone ( *args , **overrides )

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

closest ( coords )

Class method that returns the exact keys for a given list of coordinates. The supplied bounds defines the extent within which the samples are drawn and the optional shape argument is the shape of the numpy array (typically the shape of the .data attribute) when applicable.

ddims

The list of deep dimensions

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

dimensions ( selection=u'all' , label=False )

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.

force_new_dynamic_value = <functools.partial object>
get_dimension ( dimension , default=None , strict=False )

Access a Dimension object by name or index. Returns the default value if the dimension is not found and strict is False. If strict is True, a KeyError is raised instead.

get_dimension_index ( dim )

Returns the index of the requested dimension.

get_dimension_type ( dim )

Returns the specified Dimension type if specified or if the dimension_values types are consistent otherwise None is returned.

get_param_values ( onlychanged=False )

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

get_value_generator = <functools.partial object>
hist ( dimension=None , num_bins=20 , bin_range=None , adjoin=True , individually=True , **kwargs )

The hist method generates a histogram to be adjoined to the Element in an AdjointLayout. By default the histogram is computed along the first value dimension of the Element, however any dimension may be selected. The number of bins and the bin_ranges and any kwargs to be passed to the histogram operation may also be supplied.

inspect_value = <functools.partial object>
map ( map_fn , specs=None , clone=True )

Recursively replaces elements using a map function when the specification applies.

matches ( spec )

A specification may be a class, a tuple or a string. Equivalent to isinstance if a class is supplied, otherwise matching occurs on type, group and label. These may be supplied as a tuple of strings or as a single string of the form “{type}.{group}.{label}”. Matching may be done on {type} alone, {type}.{group}, or {type}.{group}.{label}. The strings for the type, group, and label will each be sanitized before the match, and so the sanitized versions of those values will need to be provided if the match is to succeed.

message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

opts ( options=None , **kwargs )

Apply the supplied options to a clone of the object which is then returned. Note that if no options are supplied at all, all ids are reset.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

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

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

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

range ( dimension , data_range=True )

Returns the range of values along the specified dimension.

If data_range is True, the data may be used to try and infer the appropriate range. Otherwise, (None,None) is returned to indicate that no range is defined.

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

Base class signature to demonstrate API for reducing Elements, using some reduce function, e.g. np.mean, which is applied along a particular Dimension. The dimensions and reduce functions should be passed as keyword arguments or as a list of dimensions and a single function.

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

Assign a new label and/or group to an existing LabelledData object, creating a clone of the object with the new settings.

sample ( samples=[] , **sample_values )

Base class signature to demonstrate API for sampling Elements. To sample an Element supply either a list of sampels or keyword arguments, where the key should match an existing key dimension on the Element.

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

Variant of __repr__ designed for generating a runnable script.

select ( selection_specs=None , **kwargs )

Allows slicing or indexing into the Dimensioned object by supplying the dimension and index/slice as key value pairs. Select descends recursively through the data structure applying the key dimension selection. The ‘value’ keyword allows selecting the value dimensions on objects which have any declared.

The selection may also be selectively applied to specific objects by supplying the selection_specs as an iterable of type.group.label specs, types or functions.

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object>
set_param = <functools.partial object>
state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

table ( datatype=None )

Converts the data Element to a Table, optionally may specify a supported data type. The default data types are ‘numpy’ (for homogeneous data), ‘dataframe’, and ‘dictionary’.

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

Traverses any nested LabelledData object (i.e LabelledData objects containing LabelledData objects), applying the supplied function to each constituent element if the supplied specifications. The output of these function calls are collected and returned in the accumulator list.

If specs is None, all constituent elements are processed. Otherwise, specs must be a list of type.group.label specs, types, and functions.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

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

Bases: holoviews.core.element.Element2D

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

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

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

param List vdims ( allow_None=False, bounds=(1, 1), constant=False, default=[Dimension(‘z’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The dimension description of the data held in the matrix.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=Raster, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
A string describing the data wrapped by the object.
param List kdims ( allow_None=False, bounds=(2, 2), constant=True, default=[Dimension(‘x’), Dimension(‘y’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The label of the x- and y-dimension of the Raster in form of a string or dimension object.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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..
param Tuple extents ( allow_None=False, constant=False, default=(None, None, None, None), instantiate=False, length=4, pickle_default_value=True, precedence=None, readonly=False )
Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.
clone ( data=None , shared_data=True , new_type=None , *args , **overrides )

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

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

closest ( coords )

Class method that returns the exact keys for a given list of coordinates. The supplied bounds defines the extent within which the samples are drawn and the optional shape argument is the shape of the numpy array (typically the shape of the .data attribute) when applicable.

ddims

The list of deep dimensions

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

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

The set of samples available along a particular dimension.

dimensions ( selection=u'all' , label=False )

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.

force_new_dynamic_value = <functools.partial object>
get_dimension ( dimension , default=None , strict=False )

Access a Dimension object by name or index. Returns the default value if the dimension is not found and strict is False. If strict is True, a KeyError is raised instead.

get_dimension_index ( dim )

Returns the index of the requested dimension.

get_dimension_type ( dim )

Returns the specified Dimension type if specified or if the dimension_values types are consistent otherwise None is returned.

get_param_values ( onlychanged=False )

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

get_value_generator = <functools.partial object>
hist ( dimension=None , num_bins=20 , bin_range=None , adjoin=True , individually=True , **kwargs )

The hist method generates a histogram to be adjoined to the Element in an AdjointLayout. By default the histogram is computed along the first value dimension of the Element, however any dimension may be selected. The number of bins and the bin_ranges and any kwargs to be passed to the histogram operation may also be supplied.

inspect_value = <functools.partial object>
map ( map_fn , specs=None , clone=True )

Recursively replaces elements using a map function when the specification applies.

matches ( spec )

A specification may be a class, a tuple or a string. Equivalent to isinstance if a class is supplied, otherwise matching occurs on type, group and label. These may be supplied as a tuple of strings or as a single string of the form “{type}.{group}.{label}”. Matching may be done on {type} alone, {type}.{group}, or {type}.{group}.{label}. The strings for the type, group, and label will each be sanitized before the match, and so the sanitized versions of those values will need to be provided if the match is to succeed.

message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

opts ( options=None , **kwargs )

Apply the supplied options to a clone of the object which is then returned. Note that if no options are supplied at all, all ids are reset.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

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

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

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

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

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

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

Assign a new label and/or group to an existing LabelledData object, creating a clone of the object with the new settings.

sample ( samples=[] , **sample_values ) [source]

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

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

Variant of __repr__ designed for generating a runnable script.

select ( selection_specs=None , **kwargs )

Allows slicing or indexing into the Dimensioned object by supplying the dimension and index/slice as key value pairs. Select descends recursively through the data structure applying the key dimension selection. The ‘value’ keyword allows selecting the value dimensions on objects which have any declared.

The selection may also be selectively applied to specific objects by supplying the selection_specs as an iterable of type.group.label specs, types or functions.

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object>
set_param = <functools.partial object>
state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

table ( datatype=None )

Converts the data Element to a Table, optionally may specify a supported data type. The default data types are ‘numpy’ (for homogeneous data), ‘dataframe’, and ‘dictionary’.

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

Traverses any nested LabelledData object (i.e LabelledData objects containing LabelledData objects), applying the supplied function to each constituent element if the supplied specifications. The output of these function calls are collected and returned in the accumulator list.

If specs is None, all constituent elements are processed. Otherwise, specs must be a list of type.group.label specs, types, and functions.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

class holoviews.element. Spikes ( data , **kwargs ) [source]

Bases: holoviews.element.chart.Chart

Spikes is a 1D or 2D Element, which represents a series of vertical or horizontal lines distributed along some dimension. If an additional dimension is supplied it will be used to specify the height of the lines. The Element may therefore be used to represent 1D distributions, spectrograms or spike trains in electrophysiology.

param List vdims ( allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The value dimensions of the Chart, usually corresponding to a number of dependent variables.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=Spikes, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
A string describing the data wrapped by the object.
param List datatype ( allow_None=False, bounds=(0, None), constant=False, default=[‘array’, ‘dataframe’, ‘dictionary’, ‘grid’, ‘ndelement’, ‘cube’, ‘xarray’, ‘dask’], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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).
param List kdims ( allow_None=False, bounds=(1, 1), constant=False, default=[Dimension(‘x’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The key dimensions of the Chart, determining the number of indexable dimensions.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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..
param Tuple extents ( allow_None=False, constant=False, default=(None, None, None, None), instantiate=False, length=4, pickle_default_value=True, precedence=None, readonly=False )
Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.
add_dimension ( dimension , dim_pos , dim_val , vdim=False , **kwargs )

Create a new object with an additional key dimensions. 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.

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

Aggregates over the supplied key dimensions with the defined function.

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

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

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

closest ( coords=[] , **kwargs )

Given a single coordinate or multiple coordinates as a tuple or list of tuples or keyword arguments matching the dimension closest will find the closest actual x/y coordinates. Different Element types should implement this appropriately depending on the space they represent, if the Element does not support snapping raise NotImplementedError.

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

Class method to collapse a list of data matching the data format of the Element type. By implementing this method HoloMap can collapse multiple Elements of the same type. The kwargs are passed to the collapse function. The collapse function must support the numpy style axis selection. Valid function include: np.mean, np.sum, np.product, np.std, scipy.stats.kurtosis etc. Some data backends also require the key dimensions to aggregate over.

ddims

The list of deep dimensions

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

dframe ( dimensions=None )

Returns the data in the form of a DataFrame. Supplying a list of dimensions filters the dataframe. If the data is already a DataFrame a copy is returned.

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

Returns the values along a particular dimension. If unique values are requested will return only unique values.

dimensions ( selection=u'all' , label=False )

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.

force_new_dynamic_value = <functools.partial object>
get_dimension ( dimension , default=None , strict=False )

Access a Dimension object by name or index. Returns the default value if the dimension is not found and strict is False. If strict is True, a KeyError is raised instead.

get_dimension_index ( dim )

Returns the index of the requested dimension.

get_dimension_type ( dim )

Returns the specified Dimension type if specified or if the dimension_values types are consistent otherwise None is returned.

get_param_values ( onlychanged=False )

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

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

Return the results of a groupby operation over the specified dimensions as an object of type container_type (expected to be dictionary-like).

Keys vary over the columns (dimensions) and the corresponding values are collections of group_type (e.g an Element, list, tuple) constructed with kwargs (if supplied).

If dynamic is requested container_type is automatically set to a DynamicMap, allowing dynamic exploration of large datasets. If the data does not represent a full cartesian grid of the requested dimensions some Elements will be empty.

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

The hist method generates a histogram to be adjoined to the Element in an AdjointLayout. By default the histogram is computed along the first value dimension of the Element, however any dimension may be selected. The number of bins and the bin_ranges and any kwargs to be passed to the histogram operation may also be supplied.

iloc

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]]

inspect_value = <functools.partial object>
map ( map_fn , specs=None , clone=True )

Recursively replaces elements using a map function when the specification applies.

matches ( spec )

A specification may be a class, a tuple or a string. Equivalent to isinstance if a class is supplied, otherwise matching occurs on type, group and label. These may be supplied as a tuple of strings or as a single string of the form “{type}.{group}.{label}”. Matching may be done on {type} alone, {type}.{group}, or {type}.{group}.{label}. The strings for the type, group, and label will each be sanitized before the match, and so the sanitized versions of those values will need to be provided if the match is to succeed.

message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

ndloc

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]]

opts ( options=None , **kwargs )

Apply the supplied options to a clone of the object which is then returned. Note that if no options are supplied at all, all ids are reset.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

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

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

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

range ( dim , data_range=True )

Computes the range of values along a supplied dimension, taking into account the range and soft_range defined on the Dimension object.

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

Allows reducing the values along one or more key dimension with the supplied function. The dimensions may be supplied as a list and a function to apply or a mapping between the dimensions and functions to apply along each dimension.

reindex ( kdims=None , vdims=None )

Create a new object with a re-ordered set of dimensions. Allows converting key dimensions to value dimensions and vice versa.

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

Assign a new label and/or group to an existing LabelledData object, creating a clone of the object with the new settings.

sample ( samples=[] , closest=True , **kwargs )

Allows sampling of Dataset as an iterator of coordinates matching the key dimensions, returning a new object containing just the selected samples. Alternatively may supply kwargs to sample a coordinate on an object. By default it will attempt to snap to the nearest coordinate if the Element supports it, snapping may be disabled with the closest argument.

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

Variant of __repr__ designed for generating a runnable script.

select ( selection_specs=None , **selection )

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

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object>
set_param = <functools.partial object>
shape

Returns the shape of the data.

sort ( by=[] )

Sorts the data by the values along the supplied dimensions.

state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

table ( datatype=None )

Converts the data Element to a Table, optionally may specify a supported data type. The default data types are ‘numpy’ (for homogeneous data), ‘dataframe’, and ‘dictionary’.

to

Property to create a conversion interface with methods to convert to other Element types.

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

Traverses any nested LabelledData object (i.e LabelledData objects containing LabelledData objects), applying the supplied function to each constituent element if the supplied specifications. The output of these function calls are collected and returned in the accumulator list.

If specs is None, all constituent elements are processed. Otherwise, specs must be a list of type.group.label specs, types, and functions.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

class holoviews.element. BoxWhisker ( data , **kwargs ) [source]

Bases: holoviews.element.chart.Chart

BoxWhisker represent data as a distributions highlighting the median, mean and various percentiles.

param List vdims ( allow_None=False, bounds=(1, 1), constant=False, default=[Dimension(‘y’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The value dimensions of the Chart, usually corresponding to a number of dependent variables.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=BoxWhisker, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
A string describing the data wrapped by the object.
param List datatype ( allow_None=False, bounds=(0, None), constant=False, default=[‘array’, ‘dataframe’, ‘dictionary’, ‘grid’, ‘ndelement’, ‘cube’, ‘xarray’, ‘dask’], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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).
param List kdims ( allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The key dimensions of the Chart, determining the number of indexable dimensions.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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..
param Tuple extents ( allow_None=False, constant=False, default=(None, None, None, None), instantiate=False, length=4, pickle_default_value=True, precedence=None, readonly=False )
Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.
add_dimension ( dimension , dim_pos , dim_val , vdim=False , **kwargs )

Create a new object with an additional key dimensions. 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.

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

Aggregates over the supplied key dimensions with the defined function.

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

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

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

closest ( coords=[] , **kwargs )

Given a single coordinate or multiple coordinates as a tuple or list of tuples or keyword arguments matching the dimension closest will find the closest actual x/y coordinates. Different Element types should implement this appropriately depending on the space they represent, if the Element does not support snapping raise NotImplementedError.

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

Class method to collapse a list of data matching the data format of the Element type. By implementing this method HoloMap can collapse multiple Elements of the same type. The kwargs are passed to the collapse function. The collapse function must support the numpy style axis selection. Valid function include: np.mean, np.sum, np.product, np.std, scipy.stats.kurtosis etc. Some data backends also require the key dimensions to aggregate over.

ddims

The list of deep dimensions

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

dframe ( dimensions=None )

Returns the data in the form of a DataFrame. Supplying a list of dimensions filters the dataframe. If the data is already a DataFrame a copy is returned.

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

Returns the values along a particular dimension. If unique values are requested will return only unique values.

dimensions ( selection=u'all' , label=False )

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.

force_new_dynamic_value = <functools.partial object>
get_dimension ( dimension , default=None , strict=False )

Access a Dimension object by name or index. Returns the default value if the dimension is not found and strict is False. If strict is True, a KeyError is raised instead.

get_dimension_index ( dim )

Returns the index of the requested dimension.

get_dimension_type ( dim )

Returns the specified Dimension type if specified or if the dimension_values types are consistent otherwise None is returned.

get_param_values ( onlychanged=False )

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

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

Return the results of a groupby operation over the specified dimensions as an object of type container_type (expected to be dictionary-like).

Keys vary over the columns (dimensions) and the corresponding values are collections of group_type (e.g an Element, list, tuple) constructed with kwargs (if supplied).

If dynamic is requested container_type is automatically set to a DynamicMap, allowing dynamic exploration of large datasets. If the data does not represent a full cartesian grid of the requested dimensions some Elements will be empty.

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

The hist method generates a histogram to be adjoined to the Element in an AdjointLayout. By default the histogram is computed along the first value dimension of the Element, however any dimension may be selected. The number of bins and the bin_ranges and any kwargs to be passed to the histogram operation may also be supplied.

iloc

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]]

inspect_value = <functools.partial object>
map ( map_fn , specs=None , clone=True )

Recursively replaces elements using a map function when the specification applies.

matches ( spec )

A specification may be a class, a tuple or a string. Equivalent to isinstance if a class is supplied, otherwise matching occurs on type, group and label. These may be supplied as a tuple of strings or as a single string of the form “{type}.{group}.{label}”. Matching may be done on {type} alone, {type}.{group}, or {type}.{group}.{label}. The strings for the type, group, and label will each be sanitized before the match, and so the sanitized versions of those values will need to be provided if the match is to succeed.

message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

ndloc

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]]

opts ( options=None , **kwargs )

Apply the supplied options to a clone of the object which is then returned. Note that if no options are supplied at all, all ids are reset.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

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

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

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

range ( dim , data_range=True )

Computes the range of values along a supplied dimension, taking into account the range and soft_range defined on the Dimension object.

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

Allows reducing the values along one or more key dimension with the supplied function. The dimensions may be supplied as a list and a function to apply or a mapping between the dimensions and functions to apply along each dimension.

reindex ( kdims=None , vdims=None )

Create a new object with a re-ordered set of dimensions. Allows converting key dimensions to value dimensions and vice versa.

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

Assign a new label and/or group to an existing LabelledData object, creating a clone of the object with the new settings.

sample ( samples=[] , closest=True , **kwargs )

Allows sampling of Dataset as an iterator of coordinates matching the key dimensions, returning a new object containing just the selected samples. Alternatively may supply kwargs to sample a coordinate on an object. By default it will attempt to snap to the nearest coordinate if the Element supports it, snapping may be disabled with the closest argument.

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

Variant of __repr__ designed for generating a runnable script.

select ( selection_specs=None , **selection )

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

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object>
set_param = <functools.partial object>
shape

Returns the shape of the data.

sort ( by=[] )

Sorts the data by the values along the supplied dimensions.

state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

table ( datatype=None )

Converts the data Element to a Table, optionally may specify a supported data type. The default data types are ‘numpy’ (for homogeneous data), ‘dataframe’, and ‘dictionary’.

to

Property to create a conversion interface with methods to convert to other Element types.

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

Traverses any nested LabelledData object (i.e LabelledData objects containing LabelledData objects), applying the supplied function to each constituent element if the supplied specifications. The output of these function calls are collected and returned in the accumulator list.

If specs is None, all constituent elements are processed. Otherwise, specs must be a list of type.group.label specs, types, and functions.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

class holoviews.element. Curve ( data , **kwargs ) [source]

Bases: holoviews.element.chart.Chart

Curve is a simple Chart Element providing 1D indexing along the x-axis.

param List vdims ( allow_None=False, bounds=(1, None), constant=False, default=[Dimension(‘y’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The value dimensions of the Chart, usually corresponding to a number of dependent variables.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=Curve, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
A string describing the data wrapped by the object.
param List datatype ( allow_None=False, bounds=(0, None), constant=False, default=[‘array’, ‘dataframe’, ‘dictionary’, ‘grid’, ‘ndelement’, ‘cube’, ‘xarray’, ‘dask’], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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).
param List kdims ( allow_None=False, bounds=(1, 2), constant=False, default=[Dimension(‘x’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The key dimensions of the Chart, determining the number of indexable dimensions.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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..
param Tuple extents ( allow_None=False, constant=False, default=(None, None, None, None), instantiate=False, length=4, pickle_default_value=True, precedence=None, readonly=False )
Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.
add_dimension ( dimension , dim_pos , dim_val , vdim=False , **kwargs )

Create a new object with an additional key dimensions. 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.

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

Aggregates over the supplied key dimensions with the defined function.

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

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

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

closest ( coords=[] , **kwargs )

Given a single coordinate or multiple coordinates as a tuple or list of tuples or keyword arguments matching the dimension closest will find the closest actual x/y coordinates. Different Element types should implement this appropriately depending on the space they represent, if the Element does not support snapping raise NotImplementedError.

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

Class method to collapse a list of data matching the data format of the Element type. By implementing this method HoloMap can collapse multiple Elements of the same type. The kwargs are passed to the collapse function. The collapse function must support the numpy style axis selection. Valid function include: np.mean, np.sum, np.product, np.std, scipy.stats.kurtosis etc. Some data backends also require the key dimensions to aggregate over.

ddims

The list of deep dimensions

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

dframe ( dimensions=None )

Returns the data in the form of a DataFrame. Supplying a list of dimensions filters the dataframe. If the data is already a DataFrame a copy is returned.

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

Returns the values along a particular dimension. If unique values are requested will return only unique values.

dimensions ( selection=u'all' , label=False )

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.

force_new_dynamic_value = <functools.partial object>
get_dimension ( dimension , default=None , strict=False )

Access a Dimension object by name or index. Returns the default value if the dimension is not found and strict is False. If strict is True, a KeyError is raised instead.

get_dimension_index ( dim )

Returns the index of the requested dimension.

get_dimension_type ( dim )

Returns the specified Dimension type if specified or if the dimension_values types are consistent otherwise None is returned.

get_param_values ( onlychanged=False )

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

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

Return the results of a groupby operation over the specified dimensions as an object of type container_type (expected to be dictionary-like).

Keys vary over the columns (dimensions) and the corresponding values are collections of group_type (e.g an Element, list, tuple) constructed with kwargs (if supplied).

If dynamic is requested container_type is automatically set to a DynamicMap, allowing dynamic exploration of large datasets. If the data does not represent a full cartesian grid of the requested dimensions some Elements will be empty.

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

The hist method generates a histogram to be adjoined to the Element in an AdjointLayout. By default the histogram is computed along the first value dimension of the Element, however any dimension may be selected. The number of bins and the bin_ranges and any kwargs to be passed to the histogram operation may also be supplied.

iloc

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]]

inspect_value = <functools.partial object>
map ( map_fn , specs=None , clone=True )

Recursively replaces elements using a map function when the specification applies.

matches ( spec )

A specification may be a class, a tuple or a string. Equivalent to isinstance if a class is supplied, otherwise matching occurs on type, group and label. These may be supplied as a tuple of strings or as a single string of the form “{type}.{group}.{label}”. Matching may be done on {type} alone, {type}.{group}, or {type}.{group}.{label}. The strings for the type, group, and label will each be sanitized before the match, and so the sanitized versions of those values will need to be provided if the match is to succeed.

message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

ndloc

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]]

opts ( options=None , **kwargs )

Apply the supplied options to a clone of the object which is then returned. Note that if no options are supplied at all, all ids are reset.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

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

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

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

range ( dim , data_range=True )

Computes the range of values along a supplied dimension, taking into account the range and soft_range defined on the Dimension object.

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

Allows reducing the values along one or more key dimension with the supplied function. The dimensions may be supplied as a list and a function to apply or a mapping between the dimensions and functions to apply along each dimension.

reindex ( kdims=None , vdims=None )

Create a new object with a re-ordered set of dimensions. Allows converting key dimensions to value dimensions and vice versa.

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

Assign a new label and/or group to an existing LabelledData object, creating a clone of the object with the new settings.

sample ( samples=[] , closest=True , **kwargs )

Allows sampling of Dataset as an iterator of coordinates matching the key dimensions, returning a new object containing just the selected samples. Alternatively may supply kwargs to sample a coordinate on an object. By default it will attempt to snap to the nearest coordinate if the Element supports it, snapping may be disabled with the closest argument.

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

Variant of __repr__ designed for generating a runnable script.

select ( selection_specs=None , **selection )

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

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object>
set_param = <functools.partial object>
shape

Returns the shape of the data.

sort ( by=[] )

Sorts the data by the values along the supplied dimensions.

state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

table ( datatype=None )

Converts the data Element to a Table, optionally may specify a supported data type. The default data types are ‘numpy’ (for homogeneous data), ‘dataframe’, and ‘dictionary’.

to

Property to create a conversion interface with methods to convert to other Element types.

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

Traverses any nested LabelledData object (i.e LabelledData objects containing LabelledData objects), applying the supplied function to each constituent element if the supplied specifications. The output of these function calls are collected and returned in the accumulator list.

If specs is None, all constituent elements are processed. Otherwise, specs must be a list of type.group.label specs, types, and functions.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

class holoviews.element. Bounds ( lbrt , **params ) [source]

Bases: holoviews.element.path.BaseShape

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

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

param List vdims ( allow_None=False, bounds=(0, None), constant=True, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=Bounds, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The assigned group name.
param List kdims ( allow_None=False, bounds=(2, 2), constant=True, default=[Dimension(‘x’), Dimension(‘y’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The label of the x- and y-dimension of the Image in form of a string or dimension object.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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..
param NumericTuple lbrt ( allow_None=False, constant=False, default=(-0.5, -0.5, 0.5, 0.5), instantiate=False, length=4, pickle_default_value=True, precedence=None, readonly=False )
The (left, bottom, right, top) coordinates of the bounding box.
param Tuple extents ( allow_None=False, constant=False, default=(None, None, None, None), instantiate=False, length=4, pickle_default_value=True, precedence=None, readonly=False )
Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.
clone ( *args , **overrides )

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

closest ( coords )

Class method that returns the exact keys for a given list of coordinates. The supplied bounds defines the extent within which the samples are drawn and the optional shape argument is the shape of the numpy array (typically the shape of the .data attribute) when applicable.

ddims

The list of deep dimensions

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

dimensions ( selection=u'all' , label=False )

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.

force_new_dynamic_value = <functools.partial object>
get_dimension ( dimension , default=None , strict=False )

Access a Dimension object by name or index. Returns the default value if the dimension is not found and strict is False. If strict is True, a KeyError is raised instead.

get_dimension_index ( dim )

Returns the index of the requested dimension.

get_dimension_type ( dim )

Returns the specified Dimension type if specified or if the dimension_values types are consistent otherwise None is returned.

get_param_values ( onlychanged=False )

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

get_value_generator = <functools.partial object>
hist ( dimension=None , num_bins=20 , bin_range=None , adjoin=True , individually=True , **kwargs )

The hist method generates a histogram to be adjoined to the Element in an AdjointLayout. By default the histogram is computed along the first value dimension of the Element, however any dimension may be selected. The number of bins and the bin_ranges and any kwargs to be passed to the histogram operation may also be supplied.

inspect_value = <functools.partial object>
map ( map_fn , specs=None , clone=True )

Recursively replaces elements using a map function when the specification applies.

matches ( spec )

A specification may be a class, a tuple or a string. Equivalent to isinstance if a class is supplied, otherwise matching occurs on type, group and label. These may be supplied as a tuple of strings or as a single string of the form “{type}.{group}.{label}”. Matching may be done on {type} alone, {type}.{group}, or {type}.{group}.{label}. The strings for the type, group, and label will each be sanitized before the match, and so the sanitized versions of those values will need to be provided if the match is to succeed.

message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

opts ( options=None , **kwargs )

Apply the supplied options to a clone of the object which is then returned. Note that if no options are supplied at all, all ids are reset.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

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

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

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

range ( dimension , data_range=True )

Returns the range of values along the specified dimension.

If data_range is True, the data may be used to try and infer the appropriate range. Otherwise, (None,None) is returned to indicate that no range is defined.

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

Base class signature to demonstrate API for reducing Elements, using some reduce function, e.g. np.mean, which is applied along a particular Dimension. The dimensions and reduce functions should be passed as keyword arguments or as a list of dimensions and a single function.

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

Assign a new label and/or group to an existing LabelledData object, creating a clone of the object with the new settings.

sample ( samples=[] , **sample_values )

Base class signature to demonstrate API for sampling Elements. To sample an Element supply either a list of sampels or keyword arguments, where the key should match an existing key dimension on the Element.

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

Variant of __repr__ designed for generating a runnable script.

select ( selection_specs=None , **kwargs )

Allows slicing or indexing into the Dimensioned object by supplying the dimension and index/slice as key value pairs. Select descends recursively through the data structure applying the key dimension selection. The ‘value’ keyword allows selecting the value dimensions on objects which have any declared.

The selection may also be selectively applied to specific objects by supplying the selection_specs as an iterable of type.group.label specs, types or functions.

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object>
set_param = <functools.partial object>
state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

table ( datatype=None )

Converts the data Element to a Table, optionally may specify a supported data type. The default data types are ‘numpy’ (for homogeneous data), ‘dataframe’, and ‘dictionary’.

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

Traverses any nested LabelledData object (i.e LabelledData objects containing LabelledData objects), applying the supplied function to each constituent element if the supplied specifications. The output of these function calls are collected and returned in the accumulator list.

If specs is None, all constituent elements are processed. Otherwise, specs must be a list of type.group.label specs, types, and functions.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

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

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

Element is the baseclass for all ViewableElement types, with an x- and y-dimension. Subclasses should define the data storage in the constructor, as well as methods and properties, which define how the data maps onto the x- and y- and value dimensions.

param List vdims ( allow_None=False, bounds=(0, None), constant=True, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=Element, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
A string describing the data wrapped by the object.
param List kdims ( allow_None=False, bounds=(0, None), constant=True, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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 , *args , **overrides )

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

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

closest ( coords ) [source]

Class method that returns the exact keys for a given list of coordinates. The supplied bounds defines the extent within which the samples are drawn and the optional shape argument is the shape of the numpy array (typically the shape of the .data attribute) when applicable.

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

Class method to collapse a list of data matching the data format of the Element type. By implementing this method HoloMap can collapse multiple Elements of the same type. The kwargs are passed to the collapse function. The collapse function must support the numpy style axis selection. Valid function include: np.mean, np.sum, np.product, np.std, scipy.stats.kurtosis etc. Some data backends also require the key dimensions to aggregate over.

ddims

The list of deep dimensions

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

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

Returns the values along the specified dimension. This method must be implemented for all Dimensioned type.

dimensions ( selection=u'all' , label=False )

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.

force_new_dynamic_value = <functools.partial object>
get_dimension ( dimension , default=None , strict=False )

Access a Dimension object by name or index. Returns the default value if the dimension is not found and strict is False. If strict is True, a KeyError is raised instead.

get_dimension_index ( dim )

Returns the index of the requested dimension.

get_dimension_type ( dim )

Returns the specified Dimension type if specified or if the dimension_values types are consistent otherwise None is returned.

get_param_values ( onlychanged=False )

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

get_value_generator = <functools.partial object>
hist ( dimension=None , num_bins=20 , bin_range=None , adjoin=True , individually=True , **kwargs ) [source]

The hist method generates a histogram to be adjoined to the Element in an AdjointLayout. By default the histogram is computed along the first value dimension of the Element, however any dimension may be selected. The number of bins and the bin_ranges and any kwargs to be passed to the histogram operation may also be supplied.

inspect_value = <functools.partial object>
map ( map_fn , specs=None , clone=True )

Recursively replaces elements using a map function when the specification applies.

matches ( spec )

A specification may be a class, a tuple or a string. Equivalent to isinstance if a class is supplied, otherwise matching occurs on type, group and label. These may be supplied as a tuple of strings or as a single string of the form “{type}.{group}.{label}”. Matching may be done on {type} alone, {type}.{group}, or {type}.{group}.{label}. The strings for the type, group, and label will each be sanitized before the match, and so the sanitized versions of those values will need to be provided if the match is to succeed.

message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

opts ( options=None , **kwargs )

Apply the supplied options to a clone of the object which is then returned. Note that if no options are supplied at all, all ids are reset.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

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

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

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

range ( dimension , data_range=True )

Returns the range of values along the specified dimension.

If data_range is True, the data may be used to try and infer the appropriate range. Otherwise, (None,None) is returned to indicate that no range is defined.

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

Base class signature to demonstrate API for reducing Elements, using some reduce function, e.g. np.mean, which is applied along a particular Dimension. The dimensions and reduce functions should be passed as keyword arguments or as a list of dimensions and a single function.

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

Assign a new label and/or group to an existing LabelledData object, creating a clone of the object with the new settings.

sample ( samples=[] , **sample_values ) [source]

Base class signature to demonstrate API for sampling Elements. To sample an Element supply either a list of sampels or keyword arguments, where the key should match an existing key dimension on the Element.

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

Variant of __repr__ designed for generating a runnable script.

select ( selection_specs=None , **kwargs )

Allows slicing or indexing into the Dimensioned object by supplying the dimension and index/slice as key value pairs. Select descends recursively through the data structure applying the key dimension selection. The ‘value’ keyword allows selecting the value dimensions on objects which have any declared.

The selection may also be selectively applied to specific objects by supplying the selection_specs as an iterable of type.group.label specs, types or functions.

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object>
set_param = <functools.partial object>
state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

table ( datatype=None ) [source]

Converts the data Element to a Table, optionally may specify a supported data type. The default data types are ‘numpy’ (for homogeneous data), ‘dataframe’, and ‘dictionary’.

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

Traverses any nested LabelledData object (i.e LabelledData objects containing LabelledData objects), applying the supplied function to each constituent element if the supplied specifications. The output of these function calls are collected and returned in the accumulator list.

If specs is None, all constituent elements are processed. Otherwise, specs must be a list of type.group.label specs, types, and functions.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

class holoviews.element. Points ( data , **kwargs ) [source]

Bases: holoviews.element.chart.Chart

Allows sets of points to be positioned over a sheet coordinate system. Each points may optionally be associated with a chosen numeric value.

The input data can be a Nx2 or Nx3 Numpy array where the first two columns corresponds to the X,Y coordinates in sheet coordinates, within the declared bounding region. For Nx3 arrays, the third column corresponds to the magnitude values of the points. Any additional columns will be ignored (use VectorFields instead).

The input data may be also be passed as a tuple of elements that may be numpy arrays or values that can be cast to arrays. When such a tuple is supplied, the elements are joined column-wise into a single array, allowing the magnitudes to be easily supplied separately.

Note that if magnitudes are to be rendered correctly by default, they should lie in the range [0,1].

param List vdims ( allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The value dimensions of the Chart, usually corresponding to a number of dependent variables.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=Points, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
A string describing the data wrapped by the object.
param List datatype ( allow_None=False, bounds=(0, None), constant=False, default=[‘array’, ‘dataframe’, ‘dictionary’, ‘grid’, ‘ndelement’, ‘cube’, ‘xarray’, ‘dask’], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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).
param List kdims ( allow_None=False, bounds=(2, 2), constant=True, default=[Dimension(‘x’), Dimension(‘y’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The label of the x- and y-dimension of the Points in form of a string or dimension object.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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..
param Tuple extents ( allow_None=False, constant=False, default=(None, None, None, None), instantiate=False, length=4, pickle_default_value=True, precedence=None, readonly=False )
Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.
add_dimension ( dimension , dim_pos , dim_val , vdim=False , **kwargs )

Create a new object with an additional key dimensions. 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.

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

Aggregates over the supplied key dimensions with the defined function.

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

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

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

closest ( coords=[] , **kwargs )

Given a single coordinate or multiple coordinates as a tuple or list of tuples or keyword arguments matching the dimension closest will find the closest actual x/y coordinates. Different Element types should implement this appropriately depending on the space they represent, if the Element does not support snapping raise NotImplementedError.

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

Class method to collapse a list of data matching the data format of the Element type. By implementing this method HoloMap can collapse multiple Elements of the same type. The kwargs are passed to the collapse function. The collapse function must support the numpy style axis selection. Valid function include: np.mean, np.sum, np.product, np.std, scipy.stats.kurtosis etc. Some data backends also require the key dimensions to aggregate over.

ddims

The list of deep dimensions

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

dframe ( dimensions=None )

Returns the data in the form of a DataFrame. Supplying a list of dimensions filters the dataframe. If the data is already a DataFrame a copy is returned.

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

Returns the values along a particular dimension. If unique values are requested will return only unique values.

dimensions ( selection=u'all' , label=False )

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.

force_new_dynamic_value = <functools.partial object>
get_dimension ( dimension , default=None , strict=False )

Access a Dimension object by name or index. Returns the default value if the dimension is not found and strict is False. If strict is True, a KeyError is raised instead.

get_dimension_index ( dim )

Returns the index of the requested dimension.

get_dimension_type ( dim )

Returns the specified Dimension type if specified or if the dimension_values types are consistent otherwise None is returned.

get_param_values ( onlychanged=False )

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

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

Return the results of a groupby operation over the specified dimensions as an object of type container_type (expected to be dictionary-like).

Keys vary over the columns (dimensions) and the corresponding values are collections of group_type (e.g an Element, list, tuple) constructed with kwargs (if supplied).

If dynamic is requested container_type is automatically set to a DynamicMap, allowing dynamic exploration of large datasets. If the data does not represent a full cartesian grid of the requested dimensions some Elements will be empty.

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

The hist method generates a histogram to be adjoined to the Element in an AdjointLayout. By default the histogram is computed along the first value dimension of the Element, however any dimension may be selected. The number of bins and the bin_ranges and any kwargs to be passed to the histogram operation may also be supplied.

iloc

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]]

inspect_value = <functools.partial object>
map ( map_fn , specs=None , clone=True )

Recursively replaces elements using a map function when the specification applies.

matches ( spec )

A specification may be a class, a tuple or a string. Equivalent to isinstance if a class is supplied, otherwise matching occurs on type, group and label. These may be supplied as a tuple of strings or as a single string of the form “{type}.{group}.{label}”. Matching may be done on {type} alone, {type}.{group}, or {type}.{group}.{label}. The strings for the type, group, and label will each be sanitized before the match, and so the sanitized versions of those values will need to be provided if the match is to succeed.

message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

ndloc

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]]

opts ( options=None , **kwargs )

Apply the supplied options to a clone of the object which is then returned. Note that if no options are supplied at all, all ids are reset.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

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

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

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

range ( dim , data_range=True )

Computes the range of values along a supplied dimension, taking into account the range and soft_range defined on the Dimension object.

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

Allows reducing the values along one or more key dimension with the supplied function. The dimensions may be supplied as a list and a function to apply or a mapping between the dimensions and functions to apply along each dimension.

reindex ( kdims=None , vdims=None )

Create a new object with a re-ordered set of dimensions. Allows converting key dimensions to value dimensions and vice versa.

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

Assign a new label and/or group to an existing LabelledData object, creating a clone of the object with the new settings.

sample ( samples=[] , closest=True , **kwargs )

Allows sampling of Dataset as an iterator of coordinates matching the key dimensions, returning a new object containing just the selected samples. Alternatively may supply kwargs to sample a coordinate on an object. By default it will attempt to snap to the nearest coordinate if the Element supports it, snapping may be disabled with the closest argument.

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

Variant of __repr__ designed for generating a runnable script.

select ( selection_specs=None , **selection )

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

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object>
set_param = <functools.partial object>
shape

Returns the shape of the data.

sort ( by=[] )

Sorts the data by the values along the supplied dimensions.

state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

table ( datatype=None )

Converts the data Element to a Table, optionally may specify a supported data type. The default data types are ‘numpy’ (for homogeneous data), ‘dataframe’, and ‘dictionary’.

to

Property to create a conversion interface with methods to convert to other Element types.

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

Traverses any nested LabelledData object (i.e LabelledData objects containing LabelledData objects), applying the supplied function to each constituent element if the supplied specifications. The output of these function calls are collected and returned in the accumulator list.

If specs is None, all constituent elements are processed. Otherwise, specs must be a list of type.group.label specs, types, and functions.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

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

Bases: holoviews.element.annotation.Annotation

Vertical line annotation at the given position

param List vdims ( allow_None=False, bounds=(0, None), constant=True, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=VLine, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
A string describing the data wrapped by the object.
param List kdims ( allow_None=False, bounds=(2, 2), constant=False, default=[Dimension(‘x’), Dimension(‘y’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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..
param ClassSelector x ( allow_None=False, constant=False, default=0, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The x-position of the VLine which make be numeric or a timestamp.
param Tuple extents ( allow_None=False, constant=False, default=(None, None, None, None), instantiate=False, length=4, pickle_default_value=True, precedence=None, readonly=False )
Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.
closest ( coords )

Class method that returns the exact keys for a given list of coordinates. The supplied bounds defines the extent within which the samples are drawn and the optional shape argument is the shape of the numpy array (typically the shape of the .data attribute) when applicable.

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

Class method to collapse a list of data matching the data format of the Element type. By implementing this method HoloMap can collapse multiple Elements of the same type. The kwargs are passed to the collapse function. The collapse function must support the numpy style axis selection. Valid function include: np.mean, np.sum, np.product, np.std, scipy.stats.kurtosis etc. Some data backends also require the key dimensions to aggregate over.

ddims

The list of deep dimensions

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

dimensions ( selection=u'all' , label=False )

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.

force_new_dynamic_value = <functools.partial object>
get_dimension ( dimension , default=None , strict=False )

Access a Dimension object by name or index. Returns the default value if the dimension is not found and strict is False. If strict is True, a KeyError is raised instead.

get_dimension_index ( dim )

Returns the index of the requested dimension.

get_dimension_type ( dim )

Returns the specified Dimension type if specified or if the dimension_values types are consistent otherwise None is returned.

get_param_values ( onlychanged=False )

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

get_value_generator = <functools.partial object>
hist ( dimension=None , num_bins=20 , bin_range=None , adjoin=True , individually=True , **kwargs )

The hist method generates a histogram to be adjoined to the Element in an AdjointLayout. By default the histogram is computed along the first value dimension of the Element, however any dimension may be selected. The number of bins and the bin_ranges and any kwargs to be passed to the histogram operation may also be supplied.

inspect_value = <functools.partial object>
map ( map_fn , specs=None , clone=True )

Recursively replaces elements using a map function when the specification applies.

matches ( spec )

A specification may be a class, a tuple or a string. Equivalent to isinstance if a class is supplied, otherwise matching occurs on type, group and label. These may be supplied as a tuple of strings or as a single string of the form “{type}.{group}.{label}”. Matching may be done on {type} alone, {type}.{group}, or {type}.{group}.{label}. The strings for the type, group, and label will each be sanitized before the match, and so the sanitized versions of those values will need to be provided if the match is to succeed.

message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

opts ( options=None , **kwargs )

Apply the supplied options to a clone of the object which is then returned. Note that if no options are supplied at all, all ids are reset.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

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

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

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

range ( dimension , data_range=True )

Returns the range of values along the specified dimension.

If data_range is True, the data may be used to try and infer the appropriate range. Otherwise, (None,None) is returned to indicate that no range is defined.

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

Base class signature to demonstrate API for reducing Elements, using some reduce function, e.g. np.mean, which is applied along a particular Dimension. The dimensions and reduce functions should be passed as keyword arguments or as a list of dimensions and a single function.

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

Assign a new label and/or group to an existing LabelledData object, creating a clone of the object with the new settings.

sample ( samples=[] , **sample_values )

Base class signature to demonstrate API for sampling Elements. To sample an Element supply either a list of sampels or keyword arguments, where the key should match an existing key dimension on the Element.

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

Variant of __repr__ designed for generating a runnable script.

select ( selection_specs=None , **kwargs )

Allows slicing or indexing into the Dimensioned object by supplying the dimension and index/slice as key value pairs. Select descends recursively through the data structure applying the key dimension selection. The ‘value’ keyword allows selecting the value dimensions on objects which have any declared.

The selection may also be selectively applied to specific objects by supplying the selection_specs as an iterable of type.group.label specs, types or functions.

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object>
set_param = <functools.partial object>
state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

table ( datatype=None )

Converts the data Element to a Table, optionally may specify a supported data type. The default data types are ‘numpy’ (for homogeneous data), ‘dataframe’, and ‘dictionary’.

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

Traverses any nested LabelledData object (i.e LabelledData objects containing LabelledData objects), applying the supplied function to each constituent element if the supplied specifications. The output of these function calls are collected and returned in the accumulator list.

If specs is None, all constituent elements are processed. Otherwise, specs must be a list of type.group.label specs, types, and functions.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

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

Bases: holoviews.element.annotation.Annotation

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

param List vdims ( allow_None=False, bounds=(0, None), constant=True, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=Arrow, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
A string describing the data wrapped by the object.
param String text ( allow_None=False, basestring=<type ‘basestring’>, constant=False, default=, instantiate=False, pickle_default_value=True, precedence=None, readonly=False )
Text associated with the arrow.
param List kdims ( allow_None=False, bounds=(2, 2), constant=False, default=[Dimension(‘x’), Dimension(‘y’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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.
param ObjectSelector direction ( allow_None=None, check_on_set=True, compute_default_fn=None, constant=False, default=<, instantiate=False, objects=[‘<’, ‘^’, ‘>’, ‘v’], pickle_default_value=True, precedence=None, readonly=False )
The cardinal direction in which the arrow is pointing. Accepted arrow directions are ‘<’, ‘^’, ‘>’ and ‘v’.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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..
param Number points ( allow_None=False, bounds=None, constant=False, default=40, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, softbounds=None, time_dependent=False, time_fn=<Time Time00001> )
Font size of arrow text (if any).
param ClassSelector x ( allow_None=False, constant=False, default=0, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The x-position of the arrow which make be numeric or a timestamp.
param ClassSelector y ( allow_None=False, constant=False, default=0, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The y-position of the arrow which make be numeric or a timestamp.
param Tuple extents ( allow_None=False, constant=False, default=(None, None, None, None), instantiate=False, length=4, pickle_default_value=True, precedence=None, readonly=False )
Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.
param ObjectSelector arrowstyle ( allow_None=None, check_on_set=True, compute_default_fn=None, constant=False, default=->, instantiate=False, objects=[‘-‘, ‘->’, ‘-[‘, ‘-|>’, ‘<->’, ‘<|-|>’], pickle_default_value=True, precedence=None, readonly=False )
The arrowstyle used to draw the arrow. Accepted arrow styles are ‘-‘, ‘->’, ‘-[‘, ‘- |>’, ‘<->’ and ‘<| - | >’
closest ( coords )

Class method that returns the exact keys for a given list of coordinates. The supplied bounds defines the extent within which the samples are drawn and the optional shape argument is the shape of the numpy array (typically the shape of the .data attribute) when applicable.

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

Class method to collapse a list of data matching the data format of the Element type. By implementing this method HoloMap can collapse multiple Elements of the same type. The kwargs are passed to the collapse function. The collapse function must support the numpy style axis selection. Valid function include: np.mean, np.sum, np.product, np.std, scipy.stats.kurtosis etc. Some data backends also require the key dimensions to aggregate over.

ddims

The list of deep dimensions

debug ( msg , *args , **kw )

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults ( )

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

dimensions ( selection=u'all' , label=False )

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.

force_new_dynamic_value = <functools.partial object>
get_dimension ( dimension , default=None , strict=False )

Access a Dimension object by name or index. Returns the default value if the dimension is not found and strict is False. If strict is True, a KeyError is raised instead.

get_dimension_index ( dim )

Returns the index of the requested dimension.

get_dimension_type ( dim )

Returns the specified Dimension type if specified or if the dimension_values types are consistent otherwise None is returned.

get_param_values ( onlychanged=False )

Return a list of name,value pairs for all Parameters of this object.

If onlychanged is True, will only return values that are not equal to the default value.

get_value_generator = <functools.partial object>
hist ( dimension=None , num_bins=20 , bin_range=None , adjoin=True , individually=True , **kwargs )

The hist method generates a histogram to be adjoined to the Element in an AdjointLayout. By default the histogram is computed along the first value dimension of the Element, however any dimension may be selected. The number of bins and the bin_ranges and any kwargs to be passed to the histogram operation may also be supplied.

inspect_value = <functools.partial object>
map ( map_fn , specs=None , clone=True )

Recursively replaces elements using a map function when the specification applies.

matches ( spec )

A specification may be a class, a tuple or a string. Equivalent to isinstance if a class is supplied, otherwise matching occurs on type, group and label. These may be supplied as a tuple of strings or as a single string of the form “{type}.{group}.{label}”. Matching may be done on {type} alone, {type}.{group}, or {type}.{group}.{label}. The strings for the type, group, and label will each be sanitized before the match, and so the sanitized versions of those values will need to be provided if the match is to succeed.

message ( msg , *args , **kw )

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

opts ( options=None , **kwargs )

Apply the supplied options to a clone of the object which is then returned. Note that if no options are supplied at all, all ids are reset.

params ( parameter_name=None )

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

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

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

print_param_defaults ( )

Print the default values of all cls’s Parameters.

print_param_values ( )

Print the values of all this object’s Parameters.

range ( dimension , data_range=True )

Returns the range of values along the specified dimension.

If data_range is True, the data may be used to try and infer the appropriate range. Otherwise, (None,None) is returned to indicate that no range is defined.

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

Base class signature to demonstrate API for reducing Elements, using some reduce function, e.g. np.mean, which is applied along a particular Dimension. The dimensions and reduce functions should be passed as keyword arguments or as a list of dimensions and a single function.

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

Assign a new label and/or group to an existing LabelledData object, creating a clone of the object with the new settings.

sample ( samples=[] , **sample_values )

Base class signature to demonstrate API for sampling Elements. To sample an Element supply either a list of sampels or keyword arguments, where the key should match an existing key dimension on the Element.

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

Variant of __repr__ designed for generating a runnable script.

select ( selection_specs=None , **kwargs )

Allows slicing or indexing into the Dimensioned object by supplying the dimension and index/slice as key value pairs. Select descends recursively through the data structure applying the key dimension selection. The ‘value’ keyword allows selecting the value dimensions on objects which have any declared.

The selection may also be selectively applied to specific objects by supplying the selection_specs as an iterable of type.group.label specs, types or functions.

set_default ( param_name , value )

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object>
set_param = <functools.partial object>
state_pop ( )

Restore the most recently saved state.

See state_push() for more details.

state_push ( )

Save this instance’s state.

For Parameterized instances, this includes the state of dynamically generated values.

Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().

Generally, this method is used by operations that need to test something without permanently altering the objects’ state.

table ( datatype=None )

Converts the data Element to a Table, optionally may specify a supported data type. The default data types are ‘numpy’ (for homogeneous data), ‘dataframe’, and ‘dictionary’.

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

Traverses any nested LabelledData object (i.e LabelledData objects containing LabelledData objects), applying the supplied function to each constituent element if the supplied specifications. The output of these function calls are collected and returned in the accumulator list.

If specs is None, all constituent elements are processed. Otherwise, specs must be a list of type.group.label specs, types, and functions.

verbose ( msg , *args , **kw )

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning ( msg , *args , **kw )

Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.

See Python’s logging module for details of message formatting.

class holoviews.element. Scatter ( data , **kwargs ) [source]

Bases: holoviews.element.chart.Chart

Scatter is a Element2D type which gets displayed as a number of disconnected points.

param List vdims ( allow_None=False, bounds=(1, None), constant=False, default=[Dimension(‘y’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The value dimensions of the Chart, usually corresponding to a number of dependent variables.
param Dict cdims ( allow_None=False, constant=False, default=OrderedDict(), instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False )
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
param String group ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=Scatter, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
A string describing the data wrapped by the object.
param List datatype ( allow_None=False, bounds=(0, None), constant=False, default=[‘array’, ‘dataframe’, ‘dictionary’, ‘grid’, ‘ndelement’, ‘cube’, ‘xarray’, ‘dask’], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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).
param List kdims ( allow_None=False, bounds=(1, 2), constant=False, default=[Dimension(‘x’)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
The key dimensions of the Chart, determining the number of indexable dimensions.
param String label ( allow_None=False, basestring=<type ‘basestring’>, constant=True, default=, instantiate=True, pickle_default_value=True, precedence=None, readonly=False )
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..
param Tuple extents ( allow_None=False, constant=False, default=(None, None, None, None), instantiate=False, length=4, pickle_default_value=True, precedence=None, readonly=False )
Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.
add_dimension ( dimension , dim_pos , dim_val , vdim=False , **kwargs )

Create a new object with an additional key dimensions. 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.

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

Aggregates over the supplied key dimensions with the defined function.

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

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

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