holoviews.core package#
Subpackages#
- holoviews.core.data package
- Submodules
- holoviews.core.data.array module
- holoviews.core.data.cudf module
- holoviews.core.data.dask module
- holoviews.core.data.dictionary module
- holoviews.core.data.grid module
- holoviews.core.data.ibis module
- holoviews.core.data.image module
- holoviews.core.data.interface module
- holoviews.core.data.multipath module
- holoviews.core.data.pandas module
- holoviews.core.data.spatialpandas module
- holoviews.core.data.spatialpandas_dask module
- holoviews.core.data.util module
- holoviews.core.data.xarray module
- Module contents
DataConversion
Dataset
Dataset.add_dimension()
Dataset.aggregate()
Dataset.clone()
Dataset.closest()
Dataset.columns()
Dataset.compute()
Dataset.dataset
Dataset.dframe()
Dataset.dimension_values()
Dataset.get_dimension_type()
Dataset.groupby()
Dataset.iloc
Dataset.map()
Dataset.ndloc
Dataset.options()
Dataset.persist()
Dataset.pipeline
Dataset.range()
Dataset.reduce()
Dataset.reindex()
Dataset.relabel()
Dataset.sample()
Dataset.select()
Dataset.shape
Dataset.sort()
Dataset.to
Dataset.transform()
PipelineMeta
concat()
disable_pipeline()
- Submodules
Submodules#
- holoviews.core.accessors module
- holoviews.core.boundingregion module
- holoviews.core.decollate module
- holoviews.core.dimension module
- holoviews.core.element module
- holoviews.core.io module
- holoviews.core.layout module
- holoviews.core.ndmapping module
MultiDimensionalMapping
MultiDimensionalMapping.add_dimension()
MultiDimensionalMapping.clone()
MultiDimensionalMapping.dimension_values()
MultiDimensionalMapping.drop_dimension()
MultiDimensionalMapping.get()
MultiDimensionalMapping.groupby()
MultiDimensionalMapping.info
MultiDimensionalMapping.items()
MultiDimensionalMapping.keys()
MultiDimensionalMapping.last
MultiDimensionalMapping.last_key
MultiDimensionalMapping.pop()
MultiDimensionalMapping.reindex()
MultiDimensionalMapping.update()
MultiDimensionalMapping.values()
NdMapping
UniformNdMapping
item_check
sorted_context
- holoviews.core.operation module
- holoviews.core.options module
AbbreviatedException
CallbackError
Compositor
Cycle
Keywords
OptionError
OptionTree
Options
Palette
SkipRendering
Store
StoreOptions
StoreOptions.apply_customizations()
StoreOptions.capture_ids()
StoreOptions.create_custom_trees()
StoreOptions.expand_compositor_keys()
StoreOptions.id_offset()
StoreOptions.merge_options()
StoreOptions.options()
StoreOptions.propagate_ids()
StoreOptions.record_skipped_option()
StoreOptions.restore_ids()
StoreOptions.set_options()
StoreOptions.start_recording_skipped()
StoreOptions.state()
StoreOptions.stop_recording_skipped()
StoreOptions.tree_to_dict()
StoreOptions.update_backends()
StoreOptions.validate_spec()
StoreOptions.validation_error_message()
abbreviated_exception
cleanup_custom_options()
lookup_options()
options_policy()
- holoviews.core.overlay module
- holoviews.core.pprint module
- holoviews.core.sheetcoords module
- Example of how the matrix stores the representation of the Sheet
SheetCoordinateSystem
SheetCoordinateSystem.closest_cell_center()
SheetCoordinateSystem.matrix2sheet()
SheetCoordinateSystem.matrixidx2sheet()
SheetCoordinateSystem.sheet2matrix()
SheetCoordinateSystem.sheet2matrixidx()
SheetCoordinateSystem.sheetcoordinates_of_matrixidx()
SheetCoordinateSystem.xdensity
SheetCoordinateSystem.ydensity
Slice
- holoviews.core.spaces module
Callable
DynamicMap
DynamicMap.add_dimension()
DynamicMap.clone()
DynamicMap.collate()
DynamicMap.current_key
DynamicMap.decollate()
DynamicMap.drop_dimension()
DynamicMap.event()
DynamicMap.grid()
DynamicMap.groupby()
DynamicMap.hist()
DynamicMap.layout()
DynamicMap.map()
DynamicMap.options()
DynamicMap.overlay()
DynamicMap.reindex()
DynamicMap.relabel()
DynamicMap.reset()
DynamicMap.select()
DynamicMap.unbounded
Generator
GridMatrix
GridSpace
HoloMap
dynamicmap_memoization()
get_nested_dmaps()
get_nested_streams()
periodic
- holoviews.core.traversal module
- holoviews.core.tree module
- holoviews.core.util module
ArgSpec
Config
HashableJSON
ProgressIndicator
VersionError
arglexsort()
argspec()
asarray()
bound_range()
bytes_to_unicode()
callable_name()
capitalize()
capitalize_unicode_name()
cartesian_product()
cast_array_to_int64()
cftime_to_timestamp()
closest_match()
compute_density()
compute_edges()
cross_index()
date_range()
deephash()
deprecated_opts_signature()
dimension_range()
dimension_sort()
dimensioned_streams()
dimensionless_contents()
disable_constant()
drop_streams()
dt64_to_dt()
dt_to_int()
expand_grid_coords()
find_minmax()
find_range()
flatten()
get_method_owner()
get_ndmapping_label()
get_overlay_spec()
get_path()
get_spec()
group_select()
int_to_alpha()
is_cyclic()
is_dataframe()
is_float()
is_int()
is_nan()
is_param_method()
is_series()
isdatetime()
isequal()
isfinite()
isnat()
isscalar()
iterative_select()
layer_groups()
layer_sort()
lazy_isinstance()
lzip()
make_path_unique()
match_spec()
max_extents()
max_range()
merge_dimensions()
merge_option_dicts()
merge_options_to_dict()
mimebundle_to_html()
ndmapping_groupby
numpy_scalar_to_python()
one_to_one()
parse_datetime()
parse_datetime_selection()
periodic
process_ellipses()
range_pad()
rename_stream_kwargs()
resolve_dependent_kwargs()
resolve_dependent_value()
sanitize_identifier_fn
search_indices()
sort_topologically()
stream_name_mapping()
stream_parameters()
tree_attribute()
unbound_dimensions()
unique_array()
unique_iterator()
unique_zip()
validate_dynamic_argspec()
validate_regular_sampling()
wrap_tuple()
wrap_tuple_streams()
Module contents#
- class holoviews.core.AdjointLayout(data, **params)[source]#
Bases:
Layoutable
,Dimensioned
An AdjointLayout provides a convenient container to lay out some marginal plots next to a primary plot. This is often useful to display the marginal distributions of a plot next to the primary plot. AdjointLayout accepts a list of up to three elements, which are laid out as follows with the names ‘main’, ‘top’ and ‘right’:
3 | ||___________|___| | | | 1: main | | | 2: right | 1 | 2 | 3: top | | | |___________|___|
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: group, cdims, vdimskdims = List(bounds=(0, None), constant=True, default=[Dimension('AdjointLayout')], label='Kdims')
The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.
- property ddims#
The list of deep dimensions
- dimension_values(dimension, expanded=True, flat=True)[source]#
Return the values along the requested dimension.
Applies to the main object in the AdjointLayout.
Parameters#
- dimension
The dimension to return values for
- expandedbool, optional
Whether to expand values Whether to return the expanded values, behavior depends on the type of data:
Columnar: If false returns unique values
Geometry: If false returns scalar values per geometry
Gridded: If false returns 1D coordinates
- flatbool, optional
Whether to flatten array
Returns#
NumPy array of values along the requested dimension
- get(key, default=None)[source]#
Returns the viewable corresponding to the supplied string or integer based key.
Parameters#
- keyNumeric or string index
0: ‘main’ 1: ‘right’ 2: ‘top’
- default
Value returned if key not found
Returns#
Indexed value or supplied default
- property group#
Group inherited from main element
- property label#
Label inherited from main element
- property main#
Returns the main element in the AdjointLayout
- relabel(label=None, group=None, depth=1)[source]#
Clone object and apply new group and/or label.
Applies relabeling to child up to the supplied depth.
Parameters#
- labelstr, optional
New label to apply to returned object
- groupstr, optional
New group to apply to returned object
- depthint, optional
Depth to which relabel will be applied If applied to container allows applying relabeling to contained objects up to the specified depth
Returns#
Returns relabelled object
- property right#
Returns the right marginal element in the AdjointLayout
- property top#
Returns the top marginal element in the AdjointLayout
- class holoviews.core.AttrTree(items=None, identifier=None, parent=None, dir_mode='default')[source]#
Bases:
object
An AttrTree offers convenient, multi-level attribute access for collections of objects. AttrTree objects may also be combined together using the update method or merge classmethod. Here is an example of adding a ViewableElement to an AttrTree and accessing it:
>>> t = AttrTree() >>> t.Example.Path = 1 >>> t.Example.Path 1
- property fixed#
If fixed, no new paths can be created via attribute access
- get(identifier, default=None)[source]#
Get a node of the AttrTree using its path string.
Parameters#
- identifier
Path string of the node to return
- default
Value to return if no node is found
Returns#
The indexed node of the AttrTree
- property path#
Returns the path up to the root for the current node.
- pop(identifier, default=None)[source]#
Pop a node of the AttrTree using its path string.
Parameters#
- identifier
Path string of the node to return
- default
Value to return if no node is found
Returns#
The node that was removed from the AttrTree
- set_path(path, val)[source]#
Set the given value at the supplied path where path is either a tuple of strings or a string in A.B.C format.
- class holoviews.core.BoundingBox(**args)[source]#
Bases:
BoundingRegion
A rectangular bounding box defined either by two points forming an axis-aligned rectangle (or simply a radius for a square).
- contains(x, y)[source]#
Returns true if the given point is contained within the bounding box, where all boundaries of the box are considered to be inclusive.
- contains_exclusive(x, y)[source]#
Return True if the given point is contained within the bounding box, where the bottom and right boundaries are considered exclusive.
- containsbb_exclusive(x)[source]#
Returns true if the given BoundingBox x is contained within the bounding box, where at least one of the boundaries of the box has to be exclusive.
- class holoviews.core.BoundingEllipse(**args)[source]#
Bases:
BoundingBox
Similar to BoundingBox, but the region is the ellipse inscribed within the rectangle.
- class holoviews.core.Collator(data=None, **params)[source]#
Bases:
NdMapping
Collator is an NdMapping type which can merge any number of HoloViews components with whatever level of nesting by inserting the Collators key dimensions on the HoloMaps. If the items in the Collator do not contain HoloMaps they will be created. Collator also supports filtering of Tree structures and dropping of constant dimensions.
Parameter Definitions
Parameters inherited from:
group = String(default='Collator', label='Group')
A string describing the data wrapped by the object.
vdims = List(bounds=(0, 0), default=[], label='Vdims')
Collator operates on HoloViews objects, if vdims are specified a value_transform function must also be supplied.
drop = List(bounds=(0, None), default=[], label='Drop')
List of dimensions to drop when collating data, specified as strings.
drop_constant = Boolean(default=False, label='Drop constant')
Whether to demote any non-varying key dimensions to constant dimensions.
filters = List(bounds=(0, None), default=[], label='Filters')
List of paths to drop when collating data, specified as strings or tuples.
progress_bar = Parameter(allow_None=True, label='Progress bar')
The progress bar instance used to report progress. Set to None to disable progress bars.
merge_type = ClassSelector(class_=<class 'holoviews.core.ndmapping.NdMapping'>, default=<class 'holoviews.core.spaces.HoloMap'>, label='Merge type')
value_transform = Callable(allow_None=True, label='Value transform')
If supplied the function will be applied on each Collator value during collation. This may be used to apply an operation to the data or load references from disk before they are collated into a displayable HoloViews object.
- property static_dimensions#
Return all constant dimensions.
- class holoviews.core.CompositeOverlay(data, kdims=None, vdims=None, **params)[source]#
Bases:
ViewableElement
,Composable
CompositeOverlay provides a common baseclass for Overlay classes.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, kdims, vdims- dimension_values(dimension, expanded=True, flat=True)[source]#
Return the values along the requested dimension.
Parameters#
- dimension
The dimension to return values for
- expandedbool, optional
Whether to expand values Whether to return the expanded values, behavior depends on the type of data:
Columnar: If false returns unique values
Geometry: If false returns scalar values per geometry
Gridded: If false returns 1D coordinates
- flatbool, optional
Whether to flatten array
Returns#
NumPy array of values along the requested dimension
- hist(dimension=None, num_bins=20, bin_range=None, adjoin=True, index=None, show_legend=False, **kwargs)[source]#
Computes and adjoins histogram along specified dimension(s).
Defaults to first value dimension if present otherwise falls back to first key dimension.
Parameters#
- dimension
Dimension(s) to compute histogram on, Falls back the plot dimensions by default.
- num_binsint, optional
Number of bins
- bin_rangetuple, optional
Lower and upper bounds of bins
- adjoinbool, optional
Whether to adjoin histogram
- indexint, optional
Index of layer to apply hist to
- show_legendbool, optional
Show legend in histogram (don’t show legend by default).
Returns#
AdjointLayout of element and histogram or just the histogram
- class holoviews.core.Dataset(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
Element
Dataset provides a general baseclass for Element types that contain structured data and supports a range of data formats.
The Dataset class supports various methods offering a consistent way of working with the stored data regardless of the storage format used. These operations include indexing, selection and various ways of aggregating or collapsing the data with a supplied function.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, kdims, vdimsgroup = String(constant=True, default='Dataset', label='Group')
A string describing the data wrapped by the object.
datatype = List(bounds=(0, None), default=['dataframe', 'dictionary', 'grid', 'xarray', 'multitabular', 'spatialpandas', 'dask_spatialpandas', 'dask', 'cuDF', 'array', 'ibis'], label='Datatype')
A priority list of the data types to be used for storage on the .data attribute. If the input supplied to the element constructor cannot be put into the requested format, the next format listed will be used until a suitable format is found (or the data fails to be understood).
- add_dimension(dimension, dim_pos, dim_val, vdim=False, **kwargs)[source]#
Adds a dimension and its values to the Dataset
Requires the dimension name or object, the desired position in the key dimensions and a key value scalar or array of values, matching the length or shape of the Dataset.
Parameters#
- dimension
Dimension or dimension spec to add
- dim_posint
Integer index to insert dimension at
- dim_valscalar or ndarray
Dimension value(s) to add
- vdim
Disabled, this type does not have value dimensions
- **kwargs
Keyword arguments passed to the cloned element
Returns#
Cloned object containing the new dimension
- aggregate(dimensions=None, function=None, spreadfn=None, **kwargs)[source]#
Aggregates data on the supplied dimensions.
Aggregates over the supplied key dimensions with the defined function or dim_transform specified as a tuple of the transformed dimension name and dim transform.
Parameters#
- dimensions
Dimension(s) to aggregate on Default to all key dimensions
- function
Aggregation function or transform to apply Supports both simple functions and dimension transforms
- spreadfn
Secondary reduction to compute value spread Useful for computing a confidence interval, spread, or standard deviation.
- **kwargs
Keyword arguments either passed to the aggregation function or to create new names for the transformed variables
Returns#
Returns the aggregated Dataset
- clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)[source]#
Clones the object, overriding data and parameters.
Parameters#
- data
New data replacing the existing data
- shared_databool, optional
Whether to use existing data
- new_typeoptional
Type to cast object to
- linkbool, optional
Whether clone should be linked Determines whether Streams and Links attached to original object will be inherited.
- *args
Additional arguments to pass to constructor
- **overrides
New keyword arguments to pass to constructor
Returns#
Cloned object
- closest(coords=None, **kwargs)[source]#
Snaps coordinate(s) to closest coordinate in Dataset
Parameters#
- coords
List of coordinates expressed as tuples
- **kwargs
Coordinates defined as keyword pairs
Returns#
List of tuples of the snapped coordinates
Raises#
- NotImplementedError
Raised if snapping is not supported
- columns(dimensions=None)[source]#
Convert dimension values to a dictionary.
Returns a dictionary of column arrays along each dimension of the element.
Parameters#
- dimensions
Dimensions to return as columns
Returns#
Dictionary of arrays for each dimension
- compute()[source]#
Computes the data to a data format that stores the daata in memory, e.g. a Dask dataframe or array is converted to a Pandas DataFrame or NumPy array.
Returns#
Dataset with the data stored in in-memory format
- property dataset#
The Dataset that this object was created from
- dframe(dimensions=None, multi_index=False)[source]#
Convert dimension values to DataFrame.
Returns a pandas dataframe of columns along each dimension, either completely flat or indexed by key dimensions.
Parameters#
- dimensions
Dimensions to return as columns
- multi_index
Convert key dimensions to (multi-)index
Returns#
DataFrame of columns corresponding to each dimension
- dimension_values(dimension, expanded=True, flat=True)[source]#
Return the values along the requested dimension.
Parameters#
- dimension
The dimension to return values for
- expandedbool, optional
Whether to expand values Whether to return the expanded values, behavior depends on the type of data:
Columnar: If false returns unique values
Geometry: If false returns scalar values per geometry
Gridded: If false returns 1D coordinates
- flatbool, optional
Whether to flatten array
Returns#
NumPy array of values along the requested dimension
- get_dimension_type(dim)[source]#
Get the type of the requested dimension.
Type is determined by Dimension.type attribute or common type of the dimension values, otherwise None.
Parameters#
- dimension
Dimension to look up by name or by index
Returns#
Declared type of values along the dimension
- groupby(dimensions=None, container_type=<class 'holoviews.core.spaces.HoloMap'>, group_type=None, dynamic=False, **kwargs)[source]#
Groups object by one or more dimensions
Applies groupby operation over the specified dimensions returning an object of type container_type (expected to be dictionary-like) containing the groups.
Parameters#
- dimensions
Dimension(s) to group by
- container_type
Type to cast group container to
- group_type
Type to cast each group to
- dynamic
Whether to return a DynamicMap
- **kwargs
Keyword arguments to pass to each group
Returns#
Returns object of supplied container_type containing the groups. If dynamic=True returns a DynamicMap instead.
- property iloc#
Returns iloc indexer with support for columnar indexing.
Returns an iloc object providing a convenient interface to slice and index into the Dataset using row and column indices. Allow selection by integer index, slice and list of integer indices and boolean arrays.
Examples :
Index the first row and column:
dataset.iloc[0, 0]
Select rows 1 and 2 with a slice:
dataset.iloc[1:3, :]
Select with a list of integer coordinates:
dataset.iloc[[0, 2, 3]]
- map(map_fn, specs=None, clone=True)[source]#
Map a function to all objects matching the specs
Recursively replaces elements using a map function when the specs apply, by default applies to all objects, e.g. to apply the function to all contained Curve objects:
dmap.map(fn, hv.Curve)
Parameters#
map_fn : Function to apply to each object specs : List of specs to match
List of types, functions or type[.group][.label] specs to select objects to return, by default applies to all objects.
- clone
Whether to clone the object or transform inplace
Returns#
Returns the object after the map_fn has been applied
- property ndloc#
Returns ndloc indexer with support for gridded indexing.
Returns an ndloc object providing nd-array like indexing for gridded datasets. Follows NumPy array indexing conventions, allowing for indexing, slicing and selecting a list of indices on multi-dimensional arrays using integer indices. The order of array indices is inverted relative to the Dataset key dimensions, e.g. an Image with key dimensions ‘x’ and ‘y’ can be indexed with
image.ndloc[iy, ix]
, whereiy
andix
are integer indices along the y and x dimensions.Examples :
Index value in 2D array:
dataset.ndloc[3, 1]
Slice along y-axis of 2D array:
dataset.ndloc[2:5, :]
Vectorized (non-orthogonal) indexing along x- and y-axes:
dataset.ndloc[[1, 2, 3], [0, 2, 3]]
- options(*args, clone=True, **kwargs)[source]#
Applies simplified option definition returning a new object.
Applies options on an object or nested group of objects in a flat format returning a new object with the options applied. If the options are to be set directly on the object a simple format may be used, e.g.:
obj.options(cmap=’viridis’, show_title=False)
If the object is nested the options must be qualified using a type[.group][.label] specification, e.g.:
obj.options(‘Image’, cmap=’viridis’, show_title=False)
or using:
obj.options({‘Image’: dict(cmap=’viridis’, show_title=False)})
Identical to the .opts method but returns a clone of the object by default.
Parameters#
- *args: Sets of options to apply to object
Supports a number of formats including lists of Options objects, a type[.group][.label] followed by a set of keyword options to apply and a dictionary indexed by type[.group][.label] specs.
- backendoptional
Backend to apply options to Defaults to current selected backend
- clonebool, optional
Whether to clone object Options can be applied inplace with clone=False
- **kwargs: Keywords of options
Set of options to apply to the object
Returns#
Returns the cloned object with the options applied
- persist()[source]#
Persists the results of a lazy data interface to memory to speed up data manipulation and visualization. If the particular data backend already holds the data in memory this is a no-op. Unlike the compute method this maintains the same data type.
Returns#
Dataset with the data persisted to memory
- property pipeline#
Chain operation that evaluates the sequence of operations that was used to create this object, starting with the Dataset stored in dataset property
- range(dim, data_range=True, dimension_range=True)[source]#
Return the lower and upper bounds of values along dimension.
Parameters#
- dim
The dimension to compute the range on.
- data_rangebool
Compute range from data values
- dimension_rangebool
Include Dimension ranges Whether to include Dimension range and soft_range in range calculation
Returns#
Tuple containing the lower and upper bound
- reduce(dimensions=None, function=None, spreadfn=None, **reductions)[source]#
Applies reduction along the specified dimension(s).
Allows reducing the values along one or more key dimension with the supplied function. Supports two signatures:
Reducing with a list of dimensions, e.g.:
ds.reduce([‘x’], np.mean)
Defining a reduction using keywords, e.g.:
ds.reduce(x=np.mean)
Parameters#
- dimensions
Dimension(s) to apply reduction on Defaults to all key dimensions
- function
Reduction operation to apply, e.g. numpy.mean
- spreadfn
Secondary reduction to compute value spread Useful for computing a confidence interval, spread, or standard deviation.
- **reductions
Keyword argument defining reduction Allows reduction to be defined as keyword pair of dimension and function
Returns#
The Dataset after reductions have been applied.
- reindex(kdims=None, vdims=None)[source]#
Reindexes Dataset dropping static or supplied kdims
Creates a new object with a reordered or reduced set of key dimensions. By default drops all non-varying key dimensions.x
Parameters#
- kdimsoptional
New list of key dimensionsx
- vdimsoptional
New list of value dimensions
Returns#
Reindexed object
- relabel(label=None, group=None, depth=0)[source]#
Clone object and apply new group and/or label.
Applies relabeling to children up to the supplied depth.
Parameters#
- labelstr, optional
New label to apply to returned object
- groupstr, optional
New group to apply to returned object
- depthint, optional
Depth to which relabel will be applied If applied to container allows applying relabeling to contained objects up to the specified depth
Returns#
Returns relabelled object
- sample(samples=None, bounds=None, closest=True, **kwargs)[source]#
Samples values at supplied coordinates.
Allows sampling of element with a list of coordinates matching the key dimensions, returning a new object containing just the selected samples. Supports multiple signatures:
Sampling with a list of coordinates, e.g.:
ds.sample([(0, 0), (0.1, 0.2), …])
Sampling a range or grid of coordinates, e.g.:
1D : ds.sample(3) 2D : ds.sample((3, 3))
Sampling by keyword, e.g.:
ds.sample(x=0)
Parameters#
samples : List of nd-coordinates to sample bounds
Bounds of the region to sample Defined as two-tuple for 1D sampling and four-tuple for 2D sampling.
- closest
Whether to snap to closest coordinates
- **kwargs
Coordinates specified as keyword pairs Keywords of dimensions and scalar coordinates
Returns#
Element containing the sampled coordinates
- select(selection_expr=None, selection_specs=None, **selection)[source]#
Applies selection by dimension name
Applies a selection along the dimensions of the object using keyword arguments. The selection may be narrowed to certain objects using selection_specs. For container objects the selection will be applied to all children as well.
Selections may select a specific value, slice or set of values:
- value: Scalar values will select rows along with an exact
match, e.g.:
ds.select(x=3)
- slice: Slices may be declared as tuples of the upper and
lower bound, e.g.:
ds.select(x=(0, 3))
- values: A list of values may be selected using a list or
set, e.g.:
ds.select(x=[0, 1, 2])
predicate expression: A holoviews.dim expression, e.g.:
from holoviews import dim ds.select(selection_expr=dim(‘x’) % 2 == 0)
Parameters#
- selection_exprholoviews.dim predicate expression
specifying selection.
- selection_specsList of specs to match on
A list of types, functions, or type[.group][.label] strings specifying which objects to apply the selection on.
- **selection: Dictionary declaring selections by dimension
Selections can be scalar values, tuple ranges, lists of discrete values and boolean arrays
Returns#
Returns an Dimensioned object containing the selected data or a scalar if a single value was selected
- property shape#
Returns the shape of the data.
- sort(by=None, reverse=False)[source]#
Sorts the data by the values along the supplied dimensions.
Parameters#
- by
Dimension(s) to sort by
- reversebool, optional
Reverse sort order
Returns#
Sorted Dataset
- property to#
Returns the conversion interface with methods to convert Dataset
- transform(*args, **kwargs)[source]#
Transforms the Dataset according to a dimension transform.
Transforms may be supplied as tuples consisting of the dimension(s) and the dim transform to apply or keyword arguments mapping from dimension(s) to dim transforms. If the arg or kwarg declares multiple dimensions the dim transform should return a tuple of values for each.
A transform may override an existing dimension or add a new one in which case it will be added as an additional value dimension.
Parameters#
- args
Specify the output arguments and transforms as a tuple of dimension specs and dim transforms
- dropbool
Whether to drop all variables not part of the transform
- keep_indexbool
- Whether to keep indexes
Whether to apply transform on datastructure with index, e.g. pandas.Series or xarray.DataArray, (important for dask datastructures where index may be required to align datasets).
- kwargs
Specify new dimensions in the form new_dim=dim_transform
Returns#
Transformed dataset with new dimensions
- class holoviews.core.Dimension(spec, **params)[source]#
Bases:
Parameterized
Dimension objects are used to specify some important general features that may be associated with a collection of values.
For instance, a Dimension may specify that a set of numeric values actually correspond to ‘Height’ (dimension name), in units of meters, with a descriptive label ‘Height of adult males’.
All dimensions object have a name that identifies them and a label containing a suitable description. If the label is not explicitly specified it matches the name.
These two parameters define the core identity of the dimension object and must match if two dimension objects are to be considered equivalent. All other parameters are considered optional metadata and are not used when testing for equality.
Unlike all the other parameters, these core parameters can be used to construct a Dimension object from a tuple. This format is sufficient to define an identical Dimension:
Dimension(‘a’, label=’Dimension A’) == Dimension((‘a’, ‘Dimension A’))
Everything else about a dimension is considered to reflect non-semantic preferences. Examples include the default value (which may be used in a visualization to set an initial slider position), how the value is to rendered as text (which may be used to specify the printed floating point precision) or a suitable range of values to consider for a particular analysis.
Units#
Full unit support with automated conversions are on the HoloViews roadmap. Once rich unit objects are supported, the unit (or more specifically the type of unit) will be part of the core dimension specification used to establish equality.
Until this feature is implemented, there are two auxiliary parameters that hold some partial information about the unit: the name of the unit and whether or not it is cyclic. The name of the unit is used as part of the pretty-printed representation and knowing whether it is cyclic is important for certain operations.
Parameter Definitions
label = String(allow_None=True, label='Label')
Unrestricted label used to describe the dimension. A label should succinctly describe the dimension and may contain any characters, including Unicode and LaTeX expression.
cyclic = Boolean(default=False, label='Cyclic')
Whether the range of this feature is cyclic such that the maximum allowed value (defined by the range parameter) is continuous with the minimum allowed value.
default = Parameter(allow_None=True, label='Default')
Default value of the Dimension which may be useful for widget or other situations that require an initial or default value.
nodata = Integer(allow_None=True, inclusive_bounds=(True, True), label='Nodata')
Optional missing-data value for integer data. If non-None, data with this value will be replaced with NaN.
range = Tuple(default=(None, None), label='Range', length=2)
Specifies the minimum and maximum allowed values for a Dimension. None is used to represent an unlimited bound.
soft_range = Tuple(default=(None, None), label='Soft range', length=2)
Specifies a minimum and maximum reference value, which may be overridden by the data.
step = Number(allow_None=True, inclusive_bounds=(True, True), label='Step')
Optional floating point step specifying how frequently the underlying space should be sampled. May be used to define a discrete sampling over the range.
type = Parameter(allow_None=True, label='Type')
Optional type associated with the Dimension values. The type may be an inbuilt constructor (such as int, str, float) or a custom class object.
unit = String(allow_None=True, label='Unit')
Optional unit string associated with the Dimension. For instance, the string ‘m’ may be used represent units of meters and ‘s’ to represent units of seconds.
value_format = Callable(allow_None=True, label='Value format')
Formatting function applied to each value before display.
values = List(bounds=(0, None), default=[], label='Values')
Optional specification of the allowed value set for the dimension that may also be used to retain a categorical ordering.
- clone(spec=None, **overrides)[source]#
Clones the Dimension with new parameters
Derive a new Dimension that inherits existing parameters except for the supplied, explicit overrides
Parameters#
- spectuple, optional
Dimension tuple specification
**overrides: Dimension parameter overrides
Returns#
Cloned Dimension object
- property pprint_label#
The pretty-printed label string for the Dimension
- pprint_value(value, print_unit=False)[source]#
Applies the applicable formatter to the value.
Parameters#
- value
Dimension value to format
Returns#
Formatted dimension value
- class holoviews.core.Dimensioned(data, kdims=None, vdims=None, **params)[source]#
Bases:
LabelledData
Dimensioned is a base class that allows the data contents of a class to be associated with dimensions. The contents associated with dimensions may be partitioned into one of three types
- key dimensions
These are the dimensions that can be indexed via the __getitem__ method. Dimension objects supporting key dimensions must support indexing over these dimensions and may also support slicing. This list ordering of dimensions describes the positional components of each multi-dimensional indexing operation.
For instance, if the key dimension names are ‘weight’ followed by ‘height’ for Dimensioned object ‘obj’, then obj[80,175] indexes a weight of 80 and height of 175.
Accessed using either kdims.
- value dimensions
These dimensions correspond to any data held on the Dimensioned object not in the key dimensions. Indexing by value dimension is supported by dimension name (when there are multiple possible value dimensions); no slicing semantics is supported and all the data associated with that dimension will be returned at once. Note that it is not possible to mix value dimensions and deep dimensions.
Accessed using either vdims.
- deep dimensions
These are dynamically computed dimensions that belong to other Dimensioned objects that are nested in the data. Objects that support this should enable the _deep_indexable flag. Note that it is not possible to mix value dimensions and deep dimensions.
Accessed using either ddims.
Dimensioned class support generalized methods for finding the range and type of values along a particular Dimension. The range method relies on the appropriate implementation of the dimension_values methods on subclasses.
The index of an arbitrary dimension is its positional index in the list of all dimensions, starting with the key dimensions, followed by the value dimensions and ending with the deep dimensions.
Parameter Definitions
Parameters inherited from:
group = String(constant=True, default='Dimensioned', label='Group')
A string describing the data wrapped by the object.
cdims = Dict(class_=<class 'dict'>, default={}, label='Cdims')
The constant dimensions defined as a dictionary of Dimension:value pairs providing additional dimension information about the object. Aliased with constant_dimensions.
kdims = List(bounds=(0, None), constant=True, default=[], label='Kdims')
The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.
vdims = List(bounds=(0, None), constant=True, default=[], label='Vdims')
The value dimensions defined as the list of dimensions used to describe the components of the data. If multiple value dimensions are supplied, a particular value dimension may be indexed by name after the key dimensions. Aliased with value_dimensions.
- property ddims#
The list of deep dimensions
- dimension_values(dimension, expanded=True, flat=True)[source]#
Return the values along the requested dimension.
Parameters#
- dimension
The dimension to return values for
- expandedbool, optional
Whether to expand values Whether to return the expanded values, behavior depends on the type of data:
- Columnar
If false returns unique values
- Geometry
If false returns scalar values per geometry
- Gridded
If false returns 1D coordinates
- flatbool, optional
Whether to flatten array
Returns#
NumPy array of values along the requested dimension
- dimensions(selection='all', label=False)[source]#
Lists the available dimensions on the object
Provides convenient access to Dimensions on nested Dimensioned objects. Dimensions can be selected by their type, i.e. ‘key’ or ‘value’ dimensions. By default ‘all’ dimensions are returned.
Parameters#
- selectionType of dimensions to return
The type of dimension, i.e. one of ‘key’, ‘value’, ‘constant’ or ‘all’.
- labelWhether to return the name, label or Dimension
Whether to return the Dimension objects (False), the Dimension names (True/’name’) or labels (‘label’).
Returns#
List of Dimension objects or their names or labels
- get_dimension(dimension, default=None, strict=False) Dimension | None [source]#
Get a Dimension object by name or index.
Parameters#
dimension : Dimension to look up by name or integer index default : optional
Value returned if Dimension not found
- strictbool, optional
Raise a KeyError if not found
Returns#
Dimension object for the requested dimension or default
- get_dimension_index(dimension)[source]#
Get the index of the requested dimension.
Parameters#
- dimension
Dimension to look up by name or by index
Returns#
Integer index of the requested dimension
- get_dimension_type(dim)[source]#
Get the type of the requested dimension.
Type is determined by Dimension.type attribute or common type of the dimension values, otherwise None.
Parameters#
- dimension
Dimension to look up by name or by index
Returns#
Declared type of values along the dimension
- options(*args, clone=True, **kwargs)[source]#
Applies simplified option definition returning a new object.
Applies options on an object or nested group of objects in a flat format returning a new object with the options applied. If the options are to be set directly on the object a simple format may be used, e.g.:
obj.options(cmap=’viridis’, show_title=False)
If the object is nested the options must be qualified using a type[.group][.label] specification, e.g.:
obj.options(‘Image’, cmap=’viridis’, show_title=False)
or using:
obj.options({‘Image’: dict(cmap=’viridis’, show_title=False)})
Identical to the .opts method but returns a clone of the object by default.
Parameters#
- *args: Sets of options to apply to object
Supports a number of formats including lists of Options objects, a type[.group][.label] followed by a set of keyword options to apply and a dictionary indexed by type[.group][.label] specs.
- backendoptional
Backend to apply options to Defaults to current selected backend
- clonebool, optional
Whether to clone object Options can be applied inplace with clone=False
- **kwargs: Keywords of options
Set of options to apply to the object
Returns#
Returns the cloned object with the options applied
- range(dimension, data_range=True, dimension_range=True)[source]#
Return the lower and upper bounds of values along dimension.
Parameters#
- dimension
The dimension to compute the range on.
- data_rangebool
Compute range from data values
- dimension_rangebool
Include Dimension ranges Whether to include Dimension range and soft_range in range calculation
Returns#
Tuple containing the lower and upper bound
- select(selection_specs=None, **kwargs)[source]#
Applies selection by dimension name
Applies a selection along the dimensions of the object using keyword arguments. The selection may be narrowed to certain objects using selection_specs. For container objects the selection will be applied to all children as well.
Selections may select a specific value, slice or set of values:
- value
Scalar values will select rows along with an exact match, e.g.:
ds.select(x=3)
- slice
Slices may be declared as tuples of the upper and lower bound, e.g.:
ds.select(x=(0, 3))
- values
A list of values may be selected using a list or set, e.g.:
ds.select(x=[0, 1, 2])
Parameters#
- selection_specsList of specs to match on
A list of types, functions, or type[.group][.label] strings specifying which objects to apply the selection on.
- **selection: Dictionary declaring selections by dimension
Selections can be scalar values, tuple ranges, lists of discrete values and boolean arrays
Returns#
Returns an Dimensioned object containing the selected data or a scalar if a single value was selected
- class holoviews.core.DynamicMap(callback, initial_items=None, streams=None, **params)[source]#
Bases:
HoloMap
A DynamicMap is a type of HoloMap where the elements are dynamically generated by a callable. The callable is invoked with values associated with the key dimensions or with values supplied by stream parameters.
Parameter Definitions
Parameters inherited from:
kdims = List(bounds=(0, None), constant=True, default=[], label='Kdims')
The key dimensions of a DynamicMap map to the arguments of the callback. This mapping can be by position or by name.
callback = ClassSelector(allow_None=True, class_=<class 'holoviews.core.spaces.Callable'>, constant=True, label='Callback')
The callable used to generate the elements. The arguments to the callable includes any number of declared key dimensions as well as any number of stream parameters defined on the input streams. If the callable is an instance of Callable it will be used directly, otherwise it will be automatically wrapped in one.
streams = List(bounds=(0, None), constant=True, default=[], label='Streams')
List of Stream instances to associate with the DynamicMap. The set of parameter values across these streams will be supplied as keyword arguments to the callback when the events are received, updating the streams. Can also be supplied as a dictionary that maps parameters or panel widgets to callback argument names that will then be automatically converted to the equivalent list format.
cache_size = Integer(bounds=(1, None), default=500, inclusive_bounds=(True, True), label='Cache size')
The number of entries to cache for fast access. This is an LRU cache where the least recently used item is overwritten once the cache is full.
positional_stream_args = Boolean(constant=True, default=False, label='Positional stream args')
If False, stream parameters are passed to the callback as keyword arguments. If True, stream parameters are passed to callback as positional arguments. Each positional argument is a dict containing the contents of a stream. The positional stream arguments follow the positional arguments for each kdim, and they are ordered to match the order of the DynamicMap’s streams list.
- add_dimension(dimension, dim_pos, dim_val, vdim=False, **kwargs)[source]#
Adds a dimension and its values to the object
Requires the dimension name or object, the desired position in the key dimensions and a key value scalar or sequence of the same length as the existing keys.
Parameters#
- dimension
Dimension or dimension spec to add
- dim_posint
Integer index to insert dimension at
- dim_valscalar or ndarray
Dimension value(s) to add
- vdim
Disabled, this type does not have value dimensions
- **kwargs
Keyword arguments passed to the cloned element
Returns#
Cloned object containing the new dimension
- clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)[source]#
Clones the object, overriding data and parameters.
Parameters#
- data
New data replacing the existing data
- shared_databool, optional
Whether to use existing data
- new_typeoptional
Type to cast object to
- linkbool, optional
Whether clone should be linked Determines whether Streams and Links attached to original object will be inherited.
- *args
Additional arguments to pass to constructor
- **overrides
New keyword arguments to pass to constructor
Returns#
Cloned object
- collate()[source]#
Unpacks DynamicMap into container of DynamicMaps
Collation allows unpacking DynamicMaps which return Layout, NdLayout or GridSpace objects into a single such object containing DynamicMaps. Assumes that the items in the layout or grid that is returned do not change.
Returns#
Collated container containing DynamicMaps
- property current_key#
Returns the current key value.
- decollate()[source]#
Packs DynamicMap of nested DynamicMaps into a single DynamicMap that returns a non-dynamic element
Decollation allows packing a DynamicMap of nested DynamicMaps into a single DynamicMap that returns a simple (non-dynamic) element. All nested streams are lifted to the resulting DynamicMap, and are available in the streams property. The callback property of the resulting DynamicMap is a pure, stateless function of the stream values. To avoid stream parameter name conflicts, the resulting DynamicMap is configured with positional_stream_args=True, and the callback function accepts stream values as positional dict arguments.
Returns#
DynamicMap that returns a non-dynamic element
- drop_dimension(dimensions)[source]#
Drops dimension(s) from keys
Parameters#
- dimensions
Dimension(s) to drop
Returns#
Clone of object with with dropped dimension(s)
- event(**kwargs)[source]#
Updates attached streams and triggers events
Automatically find streams matching the supplied kwargs to update and trigger events on them.
Parameters#
- **kwargs
Events to update streams with
- grid(dimensions=None, **kwargs)[source]#
Groups data by supplied dimension(s) laying the groups along the dimension(s) out in a GridSpace.
Parameters#
- dimensionsDimension/str or list
Dimension or list of dimensions to group by
Returns#
- gridGridSpace
GridSpace with supplied dimensions
- groupby(dimensions=None, container_type=None, group_type=None, **kwargs)[source]#
Groups DynamicMap by one or more dimensions
Applies groupby operation over the specified dimensions returning an object of type container_type (expected to be dictionary-like) containing the groups.
Parameters#
dimensions : Dimension(s) to group by container_type : Type to cast group container to group_type : Type to cast each group to dynamic : Whether to return a DynamicMap **kwargs: Keyword arguments to pass to each group
Returns#
Returns object of supplied container_type containing the groups. If dynamic=True returns a DynamicMap instead.
- hist(dimension=None, num_bins=20, bin_range=None, adjoin=True, **kwargs)[source]#
Computes and adjoins histogram along specified dimension(s).
Defaults to first value dimension if present otherwise falls back to first key dimension.
Parameters#
dimension : Dimension(s) to compute histogram on num_bins : int, optional
Number of bins
- bin_rangetuple, optional
Lower and upper bounds of bins
- adjoinbool, optional
Whether to adjoin histogram
Returns#
AdjointLayout of DynamicMap and adjoined histogram if adjoin=True, otherwise just the histogram
- layout(dimensions=None, **kwargs)[source]#
Groups data by supplied dimension(s) laying the groups along the dimension(s) out in a NdLayout.
Parameters#
- dimensionsDimension/str or list
Dimension or list of dimensions to group by
Returns#
- layoutNdLayout
NdLayout with supplied dimensions
- map(map_fn, specs=None, clone=True, link_inputs=True)[source]#
Map a function to all objects matching the specs
Recursively replaces elements using a map function when the specs apply, by default applies to all objects, e.g. to apply the function to all contained Curve objects:
dmap.map(fn, hv.Curve)
Parameters#
map_fn : Function to apply to each object specs : List of specs to match
List of types, functions or type[.group][.label] specs to select objects to return, by default applies to all objects.
clone : Whether to clone the object or transform inplace
Returns#
Returns the object after the map_fn has been applied
- options(*args, **kwargs)[source]#
Applies simplified option definition returning a new object.
Applies options defined in a flat format to the objects returned by the DynamicMap. If the options are to be set directly on the objects returned by the DynamicMap a simple format may be used, e.g.:
obj.options(cmap=’viridis’, show_title=False)
If the object is nested the options must be qualified using a type[.group][.label] specification, e.g.:
obj.options(‘Image’, cmap=’viridis’, show_title=False)
or using:
obj.options({‘Image’: dict(cmap=’viridis’, show_title=False)})
Parameters#
- *args
Sets of options to apply to object Supports a number of formats including lists of Options objects, a type[.group][.label] followed by a set of keyword options to apply and a dictionary indexed by type[.group][.label] specs.
- backendoptional
Backend to apply options to Defaults to current selected backend
- clonebool, optional
Whether to clone object Options can be applied inplace with clone=False
- **kwargs
Keywords of options Set of options to apply to the object
Returns#
Returns the cloned object with the options applied
- overlay(dimensions=None, **kwargs)[source]#
Group by supplied dimension(s) and overlay each group
Groups data by supplied dimension(s) overlaying the groups along the dimension(s).
Parameters#
dimensions : Dimension(s) of dimensions to group by
Returns#
NdOverlay object(s) with supplied dimensions
- reindex(kdims=None, force=False)[source]#
Reorders key dimensions on DynamicMap
Create a new object with a reordered set of key dimensions. Dropping dimensions is not allowed on a DynamicMap.
Parameters#
kdims : List of dimensions to reindex the mapping with force : Not applicable to a DynamicMap
Returns#
Reindexed DynamicMap
- relabel(label=None, group=None, depth=1)[source]#
Clone object and apply new group and/or label.
Applies relabeling to children up to the supplied depth.
Parameters#
- labelstr, optional
New label to apply to returned object
- groupstr, optional
New group to apply to returned object
- depthint, optional
Depth to which relabel will be applied If applied to container allows applying relabeling to contained objects up to the specified depth
Returns#
Returns relabelled object
- select(selection_specs=None, **kwargs)[source]#
Applies selection by dimension name
Applies a selection along the dimensions of the object using keyword arguments. The selection may be narrowed to certain objects using selection_specs. For container objects the selection will be applied to all children as well.
Selections may select a specific value, slice or set of values:
- value: Scalar values will select rows along with an exact
match, e.g.:
ds.select(x=3)
- slice: Slices may be declared as tuples of the upper and
lower bound, e.g.:
ds.select(x=(0, 3))
- values: A list of values may be selected using a list or
set, e.g.:
ds.select(x=[0, 1, 2])
Parameters#
- selection_specsList of specs to match on
A list of types, functions, or type[.group][.label] strings specifying which objects to apply the selection on.
- **selection: Dictionary declaring selections by dimension
Selections can be scalar values, tuple ranges, lists of discrete values and boolean arrays
Returns#
Returns an Dimensioned object containing the selected data or a scalar if a single value was selected
- property unbounded#
Returns a list of key dimensions that are unbounded, excluding stream parameters. If any of these key dimensions are unbounded, the DynamicMap as a whole is also unbounded.
- class holoviews.core.Element(data, kdims=None, vdims=None, **params)[source]#
Bases:
ViewableElement
,Composable
,Overlayable
Element is the atomic datastructure used to wrap some data with an associated visual representation, e.g. an element may represent a set of points, an image or a curve. Elements provide a common API for interacting with data of different types and define how the data map to a set of dimensions and how those map to the visual representation.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, kdims, vdimsgroup = String(constant=True, default='Element', label='Group')
A string describing the data wrapped by the object.
- array(dimensions=None)[source]#
Convert dimension values to columnar array.
Parameters#
- dimensions
List of dimensions to return
Returns#
Array of columns corresponding to each dimension
- closest(coords, **kwargs)[source]#
Snap list or dict of coordinates to closest position.
Parameters#
- coords
List of 1D or 2D coordinates
- **kwargs
Coordinates specified as keyword pairs
Returns#
List of tuples of the snapped coordinates
Raises#
- NotImplementedError
Raised if snapping is not supported
- dframe(dimensions=None, multi_index=False)[source]#
Convert dimension values to DataFrame.
Returns a pandas dataframe of columns along each dimension, either completely flat or indexed by key dimensions.
Parameters#
- dimensions
Dimensions to return as columns
- multi_index
Convert key dimensions to (multi-)index
Returns#
DataFrame of columns corresponding to each dimension
- hist(dimension=None, num_bins=20, bin_range=None, adjoin=True, **kwargs)[source]#
Computes and adjoins histogram along specified dimension(s).
Defaults to first value dimension if present otherwise falls back to first key dimension.
Parameters#
- dimension
Dimension(s) to compute histogram on
- num_binsint, optional
Number of bins
- bin_rangetuple, optional
Lower and upper bounds of bins
- adjoinbool, optional
Whether to adjoin histogram
Returns#
AdjointLayout of element and histogram or just the histogram
- reduce(dimensions=None, function=None, spreadfn=None, **reduction)[source]#
Applies reduction along the specified dimension(s).
Allows reducing the values along one or more key dimension with the supplied function. Supports two signatures:
Reducing with a list of dimensions, e.g.:
ds.reduce([‘x’], np.mean)
Defining a reduction using keywords, e.g.:
ds.reduce(x=np.mean)
Parameters#
- dimensions
Dimension(s) to apply reduction on Defaults to all key dimensions
- function
Reduction operation to apply, e.g. numpy.mean
- spreadfn
Secondary reduction to compute value spread Useful for computing a confidence interval, spread, or standard deviation.
- **reductions
Keyword argument defining reduction Allows reduction to be defined as keyword pair of dimension and function
Returns#
The element after reductions have been applied.
- sample(samples=None, bounds=None, closest=False, **sample_values)[source]#
Samples values at supplied coordinates.
Allows sampling of element with a list of coordinates matching the key dimensions, returning a new object containing just the selected samples. Supports multiple signatures:
Sampling with a list of coordinates, e.g.:
ds.sample([(0, 0), (0.1, 0.2), …])
Sampling a range or grid of coordinates, e.g.:
1D : ds.sample(3) 2D : ds.sample((3, 3))
Sampling by keyword, e.g.:
ds.sample(x=0)
Parameters#
- samples
List of nd-coordinates to sample
- bounds
Bounds of the region to sample Defined as two-tuple for 1D sampling and four-tuple for 2D sampling.
- closest
Whether to snap to closest coordinates
- **kwargs
Coordinates specified as keyword pairs Keywords of dimensions and scalar coordinates
Returns#
Element containing the sampled coordinates
- class holoviews.core.Element2D(data, kdims=None, vdims=None, **params)[source]#
Bases:
Element
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, kdims, vdimsextents = Tuple(default=(None, None, None, None), label='Extents', length=4)
Allows overriding the extents of the Element in 2D space defined as four-tuple defining the (left, bottom, right and top) edges.
- class holoviews.core.Element3D(data, kdims=None, vdims=None, **params)[source]#
Bases:
Element2D
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, kdims, vdimsextents = Tuple(default=(None, None, None, None, None, None), label='Extents', length=6)
Allows overriding the extents of the Element in 3D space defined as (xmin, ymin, zmin, xmax, ymax, zmax).
- class holoviews.core.Empty(*, cdims, kdims, vdims, group, label, name)[source]#
Bases:
Dimensioned
,Composable
Empty may be used to define an empty placeholder in a Layout. It can be placed in a Layout just like any regular Element and container type via the + operator or by passing it to the Layout constructor as a part of a list.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, kdims, vdimsgroup = String(default='Empty', label='Group')
A string describing the data wrapped by the object.
- class holoviews.core.GridMatrix(initial_items=None, kdims=None, **params)[source]#
Bases:
GridSpace
GridMatrix is container type for heterogeneous Element types laid out in a grid. Unlike a GridSpace the axes of the Grid must not represent an actual coordinate space, but may be used to plot various dimensions against each other. The GridMatrix is usually constructed using the gridmatrix operation, which will generate a GridMatrix plotting each dimension in an Element against each other.
Parameter Definitions
Parameters inherited from:
- class holoviews.core.GridSpace(initial_items=None, kdims=None, **params)[source]#
Bases:
Layoutable
,UniformNdMapping
Grids are distinct from Layouts as they ensure all contained elements to be of the same type. Unlike Layouts, which have integer keys, Grids usually have floating point keys, which correspond to a grid sampling in some two-dimensional space. This two-dimensional space may have to arbitrary dimensions, e.g. for 2D parameter spaces.
Parameter Definitions
Parameters inherited from:
kdims = List(bounds=(1, 2), default=[Dimension('X'), Dimension('Y')], label='Kdims')
The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.
- decollate()[source]#
Packs GridSpace of DynamicMaps into a single DynamicMap that returns a GridSpace
Decollation allows packing a GridSpace of DynamicMaps into a single DynamicMap that returns a GridSpace of simple (non-dynamic) elements. All nested streams are lifted to the resulting DynamicMap, and are available in the streams property. The callback property of the resulting DynamicMap is a pure, stateless function of the stream values. To avoid stream parameter name conflicts, the resulting DynamicMap is configured with positional_stream_args=True, and the callback function accepts stream values as positional dict arguments.
Returns#
DynamicMap that returns a GridSpace
- keys(full_grid=False)[source]#
Returns the keys of the GridSpace
Parameters#
- full_gridbool, optional
Return full cross-product of keys
Returns#
List of keys
- property last#
The last of a GridSpace is another GridSpace constituted of the last of the individual elements. To access the elements by their X,Y position, either index the position directly or use the items() method.
- property shape#
Returns the 2D shape of the GridSpace as (rows, cols).
- class holoviews.core.HoloMap(initial_items=None, kdims=None, group=None, label=None, **params)[source]#
Bases:
Layoutable
,UniformNdMapping
,Overlayable
A HoloMap is an n-dimensional mapping of viewable elements or overlays. Each item in a HoloMap has an tuple key defining the values along each of the declared key dimensions, defining the discretely sampled space of values.
The visual representation of a HoloMap consists of the viewable objects inside the HoloMap which can be explored by varying one or more widgets mapping onto the key dimensions of the HoloMap.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.ndmapping.MultiDimensionalMapping
: kdims, vdims, sort- collate(merge_type=None, drop=None, drop_constant=False)[source]#
Collate allows reordering nested containers
Collation allows collapsing nested mapping types by merging their dimensions. In simple terms in merges nested containers into a single merged type.
In the simple case a HoloMap containing other HoloMaps can easily be joined in this way. However collation is particularly useful when the objects being joined are deeply nested, e.g. you want to join multiple Layouts recorded at different times, collation will return one Layout containing HoloMaps indexed by Time. Changing the merge_type will allow merging the outer Dimension into any other UniformNdMapping type.
Parameters#
- merge_type
Type of the object to merge with
- drop
List of dimensions to drop
- drop_constant
Drop constant dimensions automatically
Returns#
Collated Layout or HoloMap
- decollate()[source]#
Packs HoloMap of DynamicMaps into a single DynamicMap that returns an HoloMap
Decollation allows packing a HoloMap of DynamicMaps into a single DynamicMap that returns an HoloMap of simple (non-dynamic) elements. All nested streams are lifted to the resulting DynamicMap, and are available in the streams property. The callback property of the resulting DynamicMap is a pure, stateless function of the stream values. To avoid stream parameter name conflicts, the resulting DynamicMap is configured with positional_stream_args=True, and the callback function accepts stream values as positional dict arguments.
Returns#
DynamicMap that returns an HoloMap
- grid(dimensions=None, **kwargs)[source]#
Group by supplied dimension(s) and lay out groups in grid
Groups data by supplied dimension(s) laying the groups along the dimension(s) out in a GridSpace.
Parameters#
- dimensionsDimension/str or list
Dimension or list of dimensions to group by
Returns#
GridSpace with supplied dimensions
- hist(dimension=None, num_bins=20, bin_range=None, adjoin=True, individually=True, **kwargs)[source]#
Computes and adjoins histogram along specified dimension(s).
Defaults to first value dimension if present otherwise falls back to first key dimension.
Parameters#
- dimension
Dimension(s) to compute histogram on
- num_binsint, optional
Number of bins
- bin_rangetuple, optional
Lower and upper bounds of bins
- adjoinbool, optional
Whether to adjoin histogram
Returns#
AdjointLayout of HoloMap and histograms or just the histograms
- layout(dimensions=None, **kwargs)[source]#
Group by supplied dimension(s) and lay out groups
Groups data by supplied dimension(s) laying the groups along the dimension(s) out in a NdLayout.
Parameters#
- dimensions
Dimension(s) to group by
Returns#
NdLayout with supplied dimensions
- options(*args, **kwargs)[source]#
Applies simplified option definition returning a new object
Applies options defined in a flat format to the objects returned by the DynamicMap. If the options are to be set directly on the objects in the HoloMap a simple format may be used, e.g.:
obj.options(cmap=’viridis’, show_title=False)
If the object is nested the options must be qualified using a type[.group][.label] specification, e.g.:
obj.options(‘Image’, cmap=’viridis’, show_title=False)
or using:
obj.options({‘Image’: dict(cmap=’viridis’, show_title=False)})
Parameters#
- *args
Sets of options to apply to object Supports a number of formats including lists of Options objects, a type[.group][.label] followed by a set of keyword options to apply and a dictionary indexed by type[.group][.label] specs.
- backendoptional
Backend to apply options to Defaults to current selected backend
- clonebool, optional
Whether to clone object Options can be applied inplace with clone=False
- **kwargs: Keywords of options
Set of options to apply to the object
Returns#
Returns the cloned object with the options applied
- overlay(dimensions=None, **kwargs)[source]#
Group by supplied dimension(s) and overlay each group
Groups data by supplied dimension(s) overlaying the groups along the dimension(s).
Parameters#
- dimensions
Dimension(s) of dimensions to group by
Returns#
NdOverlay object(s) with supplied dimensions
- relabel(label=None, group=None, depth=1)[source]#
Clone object and apply new group and/or label.
Applies relabeling to children up to the supplied depth.
Parameters#
- labelstr, optional
New label to apply to returned object
- groupstr, optional
New group to apply to returned object
- depthint, optional
Depth to which relabel will be applied If applied to container allows applying relabeling to contained objects up to the specified depth
Returns#
Returns relabelled object
- class holoviews.core.Layout(items=None, identifier=None, parent=None, **kwargs)[source]#
Bases:
Layoutable
,ViewableTree
A Layout is an ViewableTree with ViewableElement objects as leaf values.
Unlike ViewableTree, a Layout supports a rich display, displaying leaf items in a grid style layout. In addition to the usual ViewableTree indexing, Layout supports indexing of items by their row and column index in the layout.
The maximum number of columns in such a layout may be controlled with the cols method.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, kdims, vdimsgroup = String(constant=True, default='Layout', label='Group')
A string describing the data wrapped by the object.
- clone(*args, **overrides)[source]#
Clones the Layout, overriding data and parameters.
Parameters#
Returns#
Cloned Layout object
- cols(ncols)[source]#
Sets the maximum number of columns in the NdLayout.
Any items beyond the set number of cols will flow onto a new row. The number of columns control the indexing and display semantics of the NdLayout.
Parameters#
- ncolsint
Number of columns to set on the NdLayout
- decollate()[source]#
Packs Layout of DynamicMaps into a single DynamicMap that returns a Layout
Decollation allows packing a Layout of DynamicMaps into a single DynamicMap that returns a Layout of simple (non-dynamic) elements. All nested streams are lifted to the resulting DynamicMap, and are available in the streams property. The callback property of the resulting DynamicMap is a pure, stateless function of the stream values. To avoid stream parameter name conflicts, the resulting DynamicMap is configured with positional_stream_args=True, and the callback function accepts stream values as positional dict arguments.
Returns#
DynamicMap that returns a Layout
- relabel(label=None, group=None, depth=1)[source]#
Clone object and apply new group and/or label.
Applies relabeling to children up to the supplied depth.
Parameters#
- labelstr, optional
New label to apply to returned object
- groupstr, optional
New group to apply to returned object
- depthint, optional
Depth to which relabel will be applied If applied to container allows applying relabeling to contained objects up to the specified depth
Returns#
Returns relabelled object
- property shape#
Tuple indicating the number of rows and columns in the Layout.
- class holoviews.core.MultiDimensionalMapping(initial_items=None, kdims=None, **params)[source]#
Bases:
Dimensioned
An MultiDimensionalMapping is a Dimensioned mapping (like a dictionary or array) that uses fixed-length multidimensional keys. This behaves like a sparse N-dimensional array that does not require a dense sampling over the multidimensional space.
If the underlying value for each (key, value) pair also supports indexing (such as a dictionary, array, or list), fully qualified (deep) indexing may be used from the top level, with the first N dimensions of the index selecting a particular Dimensioned object and the remaining dimensions indexing into that object.
For instance, for a MultiDimensionalMapping with dimensions “Year” and “Month” and underlying values that are 2D floating-point arrays indexed by (r,c), a 2D array may be indexed with x[2000,3] and a single floating-point number may be indexed as x[2000,3,1,9].
In practice, this class is typically only used as an abstract base class, because the NdMapping subclass extends it with a range of useful slicing methods for selecting subsets of the data. Even so, keeping the slicing support separate from the indexing and data storage methods helps make both classes easier to understand.
Parameter Definitions
Parameters inherited from:
group = String(constant=True, default='MultiDimensionalMapping', label='Group')
A string describing the data wrapped by the object.
kdims = List(bounds=(0, None), constant=True, default=[Dimension('Default')], label='Kdims')
The key dimensions defined as list of dimensions that may be used in indexing (and potential slicing) semantics. The order of the dimensions listed here determines the semantics of each component of a multi-dimensional indexing operation. Aliased with key_dimensions.
vdims = List(bounds=(0, 0), constant=True, default=[], label='Vdims')
The value dimensions defined as the list of dimensions used to describe the components of the data. If multiple value dimensions are supplied, a particular value dimension may be indexed by name after the key dimensions. Aliased with value_dimensions.
sort = Boolean(default=True, label='Sort')
Whether the items should be sorted in the constructor.
- add_dimension(dimension, dim_pos, dim_val, vdim=False, **kwargs)[source]#
Adds a dimension and its values to the object
Requires the dimension name or object, the desired position in the key dimensions and a key value scalar or sequence of the same length as the existing keys.
Parameters#
- dimension
Dimension or dimension spec to add
- dim_posint
Integer index to insert dimension at
- dim_valscalar or ndarray
Dimension value(s) to add
- vdim
Disabled, this type does not have value dimensions
- **kwargs
Keyword arguments passed to the cloned element
Returns#
Cloned object containing the new dimension
- clone(data=None, shared_data=True, *args, **overrides)[source]#
Clones the object, overriding data and parameters.
Parameters#
- data
New data replacing the existing data
- shared_databool, optional
Whether to use existing data
- new_typeoptional
Type to cast object to
- linkbool, optional
Whether clone should be linked Determines whether Streams and Links attached to original object will be inherited.
- *args
Additional arguments to pass to constructor
- **overrides
New keyword arguments to pass to constructor
Returns#
Cloned object
- dimension_values(dimension, expanded=True, flat=True)[source]#
Return the values along the requested dimension.
Parameters#
- dimension
The dimension to return values for
- expandedbool, optional
Whether to expand values Whether to return the expanded values, behavior depends on the type of data:
Columnar: If false returns unique values
Geometry: If false returns scalar values per geometry
Gridded: If false returns 1D coordinates
- flatbool, optional
Whether to flatten array
Returns#
NumPy array of values along the requested dimension
- drop_dimension(dimensions)[source]#
Drops dimension(s) from keys
Parameters#
- dimensions
Dimension(s) to drop
Returns#
Clone of object with with dropped dimension(s)
- groupby(dimensions, container_type=None, group_type=None, **kwargs)[source]#
Groups object by one or more dimensions
Applies groupby operation over the specified dimensions returning an object of type container_type (expected to be dictionary-like) containing the groups.
Parameters#
- dimensions
Dimension(s) to group by
- container_type
Type to cast group container to
- group_type
Type to cast each group to
- dynamic
Whether to return a DynamicMap
- **kwargs
Keyword arguments to pass to each group
Returns#
Returns object of supplied container_type containing the groups. If dynamic=True returns a DynamicMap instead.
- property info#
Prints information about the Dimensioned object, including the number and type of objects contained within it and information about its dimensions.
- property last#
Returns the item highest data item along the map dimensions.
- property last_key#
Returns the last key value.
- reindex(kdims=None, force=False)[source]#
Reindexes object dropping static or supplied kdims
Creates a new object with a reordered or reduced set of key dimensions. By default drops all non-varying key dimensions.
Reducing the number of key dimensions will discard information from the keys. All data values are accessible in the newly created object as the new labels must be sufficient to address each value uniquely.
Parameters#
- kdimsoptional
New list of key dimensions after reindexing
- forcebool, optional
Whether to drop non-unique items
Returns#
Reindexed object
- class holoviews.core.NdLayout(initial_items=None, kdims=None, **params)[source]#
Bases:
Layoutable
,UniformNdMapping
NdLayout is a UniformNdMapping providing an n-dimensional data structure to display the contained Elements and containers in a layout. Using the cols method the NdLayout can be rearranged with the desired number of columns.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.ndmapping.MultiDimensionalMapping
: kdims, vdims, sort- clone(*args, **overrides)[source]#
Clones the NdLayout, overriding data and parameters.
Parameters#
Returns#
Cloned NdLayout object
- cols(ncols)[source]#
Sets the maximum number of columns in the NdLayout.
Any items beyond the set number of cols will flow onto a new row. The number of columns control the indexing and display semantics of the NdLayout.
Parameters#
- ncolsint
Number of columns to set on the NdLayout
- grid_items()[source]#
Compute a dict of {(row,column): (key, value)} elements from the current set of items and specified number of columns.
- property last#
Returns another NdLayout constituted of the last views of the individual elements (if they are maps).
- property shape#
Tuple indicating the number of rows and columns in the NdLayout.
- class holoviews.core.NdMapping(initial_items=None, kdims=None, **params)[source]#
Bases:
MultiDimensionalMapping
NdMapping supports the same indexing semantics as MultiDimensionalMapping but also supports slicing semantics.
Slicing semantics on an NdMapping is dependent on the ordering semantics of the keys. As MultiDimensionalMapping sort the keys, a slice on an NdMapping is effectively a way of filtering out the keys that are outside the slice range.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.ndmapping.MultiDimensionalMapping
: kdims, vdims, sortgroup = String(constant=True, default='NdMapping', label='Group')
A string describing the data wrapped by the object.
- class holoviews.core.NdOverlay(overlays=None, kdims=None, **params)[source]#
Bases:
Overlayable
,UniformNdMapping
,CompositeOverlay
An NdOverlay allows a group of NdOverlay to be overlaid together. NdOverlay can be indexed out of an overlay and an overlay is an iterable that iterates over the contained layers.
Parameter Definitions
Parameters inherited from:
kdims = List(bounds=(0, None), constant=True, default=[Dimension('Element')], label='Kdims')
List of dimensions the NdOverlay can be indexed by.
- decollate()[source]#
Packs NdOverlay of DynamicMaps into a single DynamicMap that returns an NdOverlay
Decollation allows packing a NdOverlay of DynamicMaps into a single DynamicMap that returns an NdOverlay of simple (non-dynamic) elements. All nested streams are lifted to the resulting DynamicMap, and are available in the streams property. The callback property of the resulting DynamicMap is a pure, stateless function of the stream values. To avoid stream parameter name conflicts, the resulting DynamicMap is configured with positional_stream_args=True, and the callback function accepts stream values as positional dict arguments.
Returns#
DynamicMap that returns an NdOverlay
- class holoviews.core.Operation(*, dynamic, group, input_ranges, link_inputs, streams, name)[source]#
Bases:
ParameterizedFunction
An Operation process an Element or HoloMap at the level of individual elements or overlays. If a holomap is passed in as input, a processed holomap is returned as output where the individual elements have been transformed accordingly. An Operation may turn overlays in new elements or vice versa.
An Operation can be set to be dynamic, which will return a DynamicMap with a callback that will apply the operation dynamically. An Operation may also supply a list of Stream classes on a streams parameter, which can allow dynamic control over the parameters on the operation.
Parameter Definitions
group = String(default='Operation', label='Group')
The group string used to identify the output of the Operation. By default this should match the operation name.
dynamic = Selector(default='default', label='Dynamic', names={}, objects=['default', True, False])
Whether the operation should be applied dynamically when a specific frame is requested, specified as a Boolean. If set to ‘default’ the mode will be determined based on the input type, i.e. if the data is a DynamicMap it will stay dynamic.
input_ranges = ClassSelector(allow_None=True, class_=(<class 'dict'>, <class 'tuple'>), default={}, label='Input ranges')
Ranges to be used for input normalization (if applicable) in a format appropriate for the Normalization.ranges parameter. By default, no normalization is applied. If key-wise normalization is required, a 2-tuple may be supplied where the first component is a Normalization.ranges list and the second component is Normalization.keys.
link_inputs = Boolean(default=False, label='Link inputs')
If the operation is dynamic, whether or not linked streams should be transferred from the operation inputs for backends that support linked streams. For example if an operation is applied to a DynamicMap with an RangeXY, this switch determines whether the corresponding visualization should update this stream with range changes originating from the newly generated axes.
streams = ClassSelector(class_=(<class 'dict'>, <class 'list'>), default=[], label='Streams')
List of streams that are applied if dynamic=True, allowing for dynamic interaction with the plot.
- classmethod get_overlay_bounds(overlay)[source]#
Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.
- classmethod get_overlay_label(overlay, default_label='')[source]#
Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.
- class holoviews.core.Overlay(items=None, group=None, label=None, **params)[source]#
Bases:
ViewableTree
,CompositeOverlay
,Layoutable
,Overlayable
An Overlay consists of multiple Elements (potentially of heterogeneous type) presented one on top each other with a particular z-ordering.
Overlays along with elements constitute the only valid leaf types of a Layout and in fact extend the Layout structure. Overlays are constructed using the * operator (building an identical structure to the + operator).
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, kdims, vdims- clone(data=None, shared_data=True, new_type=None, link=True, **overrides)[source]#
Clones the object, overriding data and parameters.
Parameters#
- data
New data replacing the existing data
- shared_databool, optional
Whether to use existing data
- new_typeoptional
Type to cast object to
- linkbool, optional
Whether clone should be linked Determines whether Streams and Links attached to original object will be inherited.
- *args
Additional arguments to pass to constructor
- **overrides
New keyword arguments to pass to constructor
Returns#
Cloned object
- collate()[source]#
Collates any objects in the Overlay resolving any issues the recommended nesting structure.
- property ddims#
The list of deep dimensions
- decollate()[source]#
Packs Overlay of DynamicMaps into a single DynamicMap that returns an Overlay
Decollation allows packing an Overlay of DynamicMaps into a single DynamicMap that returns an Overlay of simple (non-dynamic) elements. All nested streams are lifted to the resulting DynamicMap, and are available in the streams property. The callback property of the resulting DynamicMap is a pure, stateless function of the stream values. To avoid stream parameter name conflicts, the resulting DynamicMap is configured with positional_stream_args=True, and the callback function accepts stream values as positional dict arguments.
Returns#
DynamicMap that returns an Overlay
- get(identifier, default=None)[source]#
Get a layer in the Overlay.
Get a particular layer in the Overlay using its path string or an integer index.
Parameters#
- identifier
Index or path string of the item to return
- default
Value to return if no item is found
Returns#
The indexed layer of the Overlay
- property group#
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
- property label#
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
- class holoviews.core.SheetCoordinateSystem(bounds, xdensity, ydensity=None)[source]#
Bases:
object
Provides methods to allow conversion between sheet and matrix coordinates.
- closest_cell_center(x, y)[source]#
Given arbitrary sheet coordinates, return the sheet coordinates of the center of the closest unit.
- matrix2sheet(float_row, float_col)[source]#
Convert a floating-point location (float_row,float_col) in matrix coordinates to its corresponding location (x,y) in sheet coordinates.
Valid for scalar or array float_row and float_col.
Inverse of sheet2matrix().
- matrixidx2sheet(row, col)[source]#
Return (x,y) where x and y are the floating point coordinates of the center of the given matrix cell (row,col). If the matrix cell represents a 0.2 by 0.2 region, then the center location returned would be 0.1,0.1.
NOTE#
This is NOT the strict mathematical inverse of sheet2matrixidx(), because sheet2matrixidx() discards all but the integer portion of the continuous matrix coordinate.
Valid only for scalar or array row and col.
- sheet2matrix(x, y)[source]#
Convert a point (x,y) in Sheet coordinates to continuous matrix coordinates.
Returns (float_row,float_col), where float_row corresponds to y, and float_col to x.
Valid for scalar or array x and y.
Note about Bounds For a Sheet with BoundingBox(points=((-0.5,-0.5),(0.5,0.5))) and density=3, x=-0.5 corresponds to float_col=0.0 and x=0.5 corresponds to float_col=3.0. float_col=3.0 is not inside the matrix representing this Sheet, which has the three columns (0,1,2). That is, x=-0.5 is inside the BoundingBox but x=0.5 is outside. Similarly, y=0.5 is inside (at row 0) but y=-0.5 is outside (at row 3) (it’s the other way round for y because the matrix row index increases as y decreases).
- sheet2matrixidx(x, y)[source]#
Convert a point (x,y) in sheet coordinates to the integer row and column index of the matrix cell in which that point falls, given a bounds and density. Returns (row,column).
Note that if coordinates along the right or bottom boundary are passed into this function, the returned matrix coordinate of the boundary will be just outside the matrix, because the right and bottom boundaries are exclusive.
Valid for scalar or array x and y.
- sheetcoordinates_of_matrixidx()[source]#
Return x,y where x is a vector of sheet coordinates representing the x-center of each matrix cell, and y represents the corresponding y-center of the cell.
- property xdensity#
The spacing between elements in an underlying matrix representation, in the x direction.
- property ydensity#
The spacing between elements in an underlying matrix representation, in the y direction.
- class holoviews.core.Tabular(data, kdims=None, vdims=None, **params)[source]#
Bases:
Element
Baseclass to give an elements providing an API to generate a tabular representation of the object.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, kdims, vdims- cell_type(row, col)[source]#
Type of the table cell, either ‘data’ or ‘heading’
Parameters#
- rowint
Integer index of table row
- colint
Integer index of table column
Returns#
Type of the table cell, either ‘data’ or ‘heading’
- property cols#
Number of columns in table
- pprint_cell(row, col)[source]#
Formatted contents of table cell.
Parameters#
- rowint
Integer index of table row
- colint
Integer index of table column
Returns#
Formatted table cell contents
- property rows#
Number of rows in table (including header)
- class holoviews.core.UniformNdMapping(initial_items=None, kdims=None, group=None, label=None, **params)[source]#
Bases:
NdMapping
A UniformNdMapping is a map of Dimensioned objects and is itself indexed over a number of specified dimensions. The dimension may be a spatial dimension (i.e., a ZStack), time (specifying a frame sequence) or any other combination of Dimensions.
UniformNdMapping objects can be sliced, sampled, reduced, overlaid and split along its and its containing Element’s dimensions. Subclasses should implement the appropriate slicing, sampling and reduction methods for their Dimensioned type.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdimsholoviews.core.ndmapping.MultiDimensionalMapping
: kdims, vdims, sort- clone(data=None, shared_data=True, new_type=None, link=True, *args, **overrides)[source]#
Clones the object, overriding data and parameters.
Parameters#
- data
New data replacing the existing data
- shared_databool, optional
Whether to use existing data
- new_typeoptional
Type to cast object to
- linkbool, optional
Whether clone should be linked Determines whether Streams and Links attached to original object will be inherited.
- *args
Additional arguments to pass to constructor
- **overrides
New keyword arguments to pass to constructor
Returns#
Cloned object
- collapse(dimensions=None, function=None, spreadfn=None, **kwargs)[source]#
Concatenates and aggregates along supplied dimensions
Useful to collapse stacks of objects into a single object, e.g. to average a stack of Images or Curves.
Parameters#
- dimensions
Dimension(s) to collapse Defaults to all key dimensions
- function
Aggregation function to apply, e.g. numpy.mean
- spreadfn
Secondary reduction to compute value spread Useful for computing a confidence interval, spread, or standard deviation.
- **kwargs
Keyword arguments passed to the aggregation function
Returns#
Returns the collapsed element or HoloMap of collapsed elements
- dframe(dimensions=None, multi_index=False)[source]#
Convert dimension values to DataFrame.
Returns a pandas dataframe of columns along each dimension, either completely flat or indexed by key dimensions.
Parameters#
- dimensions
Dimensions to return as columns
- multi_index
Convert key dimensions to (multi-)index
Returns#
DataFrame of columns corresponding to each dimension
- property group#
Group inherited from items
- property label#
Label inherited from items
- property type#
The type of elements stored in the mapping.
- class holoviews.core.ViewableElement(data, kdims=None, vdims=None, **params)[source]#
Bases:
Dimensioned
A ViewableElement is a dimensioned datastructure that may be associated with a corresponding atomic visualization. An atomic visualization will display the data on a single set of axes (i.e. excludes multiple subplots that are displayed at once). The only new parameter introduced by ViewableElement is the title associated with the object for display.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, kdims, vdimsgroup = String(constant=True, default='ViewableElement', label='Group')
A string describing the data wrapped by the object.
- class holoviews.core.ViewableTree(items=None, identifier=None, parent=None, **kwargs)[source]#
Bases:
AttrTree
,Dimensioned
A ViewableTree is an AttrTree with Viewable objects as its leaf nodes. It combines the tree like data structure of a tree while extending it with the deep indexable properties of Dimensioned and LabelledData objects.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, kdims, vdimsgroup = String(constant=True, default='ViewableTree', label='Group')
A string describing the data wrapped by the object.
- dimension_values(dimension, expanded=True, flat=True)[source]#
Return the values along the requested dimension.
Concatenates values on all nodes with requested dimension.
Parameters#
- dimension
The dimension to return values for
- expandedbool, optional
Whether to expand values Whether to return the expanded values, behavior depends on the type of data:
- Columnar
If false returns unique values
- Geometry
If false returns scalar values per geometry
- Gridded
If false returns 1D coordinates
- flatbool, optional
Whether to flatten array
Returns#
NumPy array of values along the requested dimension
- property uniform#
Whether items in tree have uniform dimensions