holoviews.core.data.grid module#

class holoviews.core.data.grid.GridInterface(*, name)[source]#

Bases: DictInterface

Interface for simple dictionary-based dataset format using a compressed representation that uses the cartesian product between key dimensions. As with DictInterface, the dictionary keys correspond to the column (i.e. dimension) names and the values are NumPy arrays representing the values in that column.

To use this compressed format, the key dimensions must be orthogonal to one another with each key dimension specifying an axis of the multidimensional space occupied by the value dimension data. For instance, given an temperature recordings sampled regularly across the earth surface, a list of N unique latitudes and M unique longitudes can specify the position of NxM temperature samples.

Parameter Definitions


classmethod canonicalize(dataset, data, data_coords=None, virtual_coords=None)[source]#

Canonicalize takes an array of values as input and reorients and transposes it to match the canonical format expected by plotting functions. In certain cases the dimensions defined via the kdims of an Element may not match the dimensions of the underlying data. A set of data_coords may be passed in to define the dimensionality of the data, which can then be used to np.squeeze the data to remove any constant dimensions. If the data is also irregular, i.e. contains multi-dimensional coordinates, a set of virtual_coords can be supplied, required by some interfaces (e.g. xarray) to index irregular datasets with a virtual integer index. This ensures these coordinates are not simply dropped.

classmethod compute(dataset)[source]#

Should return a computed version of the Dataset.

classmethod coords(dataset, dim, ordered=False, expanded=False, edges=False)[source]#

Returns the coordinates along a dimension. Ordered ensures coordinates are in ascending order and expanded creates ND-array matching the dimensionality of the dataset.

classmethod persist(dataset)[source]#

Should return a persisted version of the Dataset.

classmethod sample(dataset, samples=None)[source]#

Samples the gridded data into dataset of samples.