chaco.multi_array_data_source module

Defines the MultiArrayDataSource class.

class chaco.multi_array_data_source.MultiArrayDataSource(data=array([], dtype=float64), sort_order='ascending', **traits)

Bases: chaco.abstract_data_source.AbstractDataSource

A data source representing a single, continuous array of multidimensional numerical data.

It is useful, for example, to define 2D vector data at each point of a scatter plot (as in QuiverPlot), or to represent multiple values for each index (as in MultiLinePlot).

This class does not listen to the array for value changes; To implement such behavior, define a subclass that hooks up the appropriate listeners.


Returns a tuple (min, max) of the bounding values for the data source. In the case of 2-D data, min and max are 2-D points that represent the bounding corners of a rectangle enclosing the data set. Note that these values are not view-dependent, but represent intrinsic properties of the data source.

If data is the empty set, then the min and max vals are 0.0.

If value and index are both None, then the method returns the global minimum and maximum for the entire data set. If value is an integer, then the method returns the minimum and maximum along the value slice in the value_dimension. If index is an integer, then the method returns the minimum and maximum along the index slice in the index_direction.


If called with no arguments, this method returns a data array. Treat this data array as read-only, and do not alter it in-place. This data is contiguous and not masked.

If axes is an integer or tuple, this method returns the data array, sliced along the index_dimension.


Implements AbstractDataSource.


Returns the shape of the multi-dimensional data source.


Implements AbstractDataSource. Returns an integer estimate, or the exact size, of the dataset that get_data() returns. This method is useful for downsampling.


Returns the size along the value dimension.

index_dimension = Int(0)

The dimensionality of the indices into this data source (overrides AbstractDataSource).


Returns True if this data source’s data uses a mask. In this case, retrieve the data using get_data_mask() instead of get_data(). If you call get_data() for this data source, it returns data, but that data may not be the expected data.)


Sets the data for this data source.


value (array) – The data to use.

sort_order = SortOrderTrait

The sort order of the data. This is a specialized optimization for 1-D arrays, but it’s an important one that’s used everywhere.

value_dimension = Int(1)

The dimensionality of the value at each index point (overrides AbstractDataSource).