holoviews.element.util module#

class holoviews.element.util.categorical_aggregate2d(*, datatype, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Generates a gridded Dataset of 2D aggregate arrays indexed by the first two dimensions of the passed Element, turning all remaining dimensions into value dimensions. The key dimensions of the gridded array are treated as categorical indices. Useful for data indexed by two independent categorical variables such as a table of population values indexed by country and year. Data that is indexed by continuous dimensions should be binned before aggregation. The aggregation will retain the global sorting order of both dimensions.

>> table = Table([(‘USA’, 2000, 282.2), (‘UK’, 2005, 58.89)],

kdims=[‘Country’, ‘Year’], vdims=[‘Population’])

>> categorical_aggregate2d(table) Dataset({‘Country’: [‘USA’, ‘UK’], ‘Year’: [2000, 2005],

‘Population’: [[ 282.2 , np.nan], [np.nan, 58.89]]},

kdims=[‘Country’, ‘Year’], vdims=[‘Population’])

Parameter Definitions


Parameters inherited from:

holoviews.core.operation.Operation: group, dynamic, input_ranges, link_inputs, streams

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

The grid interface types to use when constructing the gridded Dataset.

holoviews.element.util.circular_layout(nodes)[source]#

Lay out nodes on a circle and add node index.

holoviews.element.util.compute_slice_bounds(slices, scs, shape)[source]#

Given a 2D selection consisting of slices/coordinates, a SheetCoordinateSystem and the shape of the array returns a new BoundingBox representing the sliced region.

holoviews.element.util.connect_edges(graph)[source]#

Given a Graph element containing abstract edges compute edge segments directly connecting the source and target nodes. This operation just uses internal HoloViews operations and will be a lot slower than the pandas equivalent.

holoviews.element.util.connect_edges_pd(graph)[source]#

Given a Graph element containing abstract edges compute edge segments directly connecting the source and target nodes. This operation depends on pandas and is a lot faster than the pure NumPy equivalent.

holoviews.element.util.connect_tri_edges_pd(trimesh)[source]#

Given a TriMesh element containing abstract edges compute edge segments directly connecting the source and target nodes. This operation depends on pandas and is a lot faster than the pure NumPy equivalent.

holoviews.element.util.quadratic_bezier(start, end, c0=(0, 0), c1=(0, 0), steps=50)[source]#

Compute quadratic bezier spline given start and end coordinate and two control points.

holoviews.element.util.reduce_fn(x)[source]#

Aggregation function to get the first non-zero value.

holoviews.element.util.split_path(path)[source]#

Split a Path type containing a single NaN separated path into multiple subpaths.