chaco.array_plot_data module

Defines ArrayPlotData.

class chaco.array_plot_data.ArrayPlotData(*data, **kw)

Bases: chaco.abstract_plot_data.AbstractPlotData

A PlotData implementation class that handles a list of Numpy arrays (or a 2-D Numpy array).

By default, it doesn’t allow its input data to be modified by downstream Chaco components or interactors.

arrays = Dict

Map of names to arrays. Although there is no restriction on the array dimensions, each array must correspond to a single plot item; that is, a single name must not map to a multi-dimensional array unless the array is being used for an image plot or for something that can handle multi-dimensional input data.

del_data(name)

Deletes the array specified by name, or raises a KeyError if the named array does not exist.

get_data(name)

Returns the array associated with name.

Implements AbstractDataSource.

list_data()

Returns a list of the names of the arrays managed by this instance.

set_data(name, new_data, generate_name=False)

Sets the specified array as the value for either the specified name or a generated name.

If the instance’s writable attribute is True, then this method sets the data associated with the given name to the new value, otherwise it does nothing.

Parameters
  • name (string) – The name of the array whose value is to be set.

  • new_data (array) – The array to set as the value of name.

  • generate_name (Boolean) – If True, a unique name of the form ‘seriesN’ is created for the array, and is used in place of name. The ‘N’ in ‘seriesN’ is one greater the largest N already used.

Returns

Return type

The name under which the array was set.

See also

update_data

Use if needing to set multiple ArrayPlotData entries at once, for example because new arrays’ dimensions change and updating one at a time would break an existing Plot.

set_selection(name, selection)

Overrides AbstractPlotData to do nothing and not raise an error.

update_data(*args, **kwargs)

Updates any number of arrays before triggering a data_changed event.

Useful to set multiple ArrayPlotData entries at once, for example because new arrays’ dimensions change and updating one at a time would break an existing Plot.

Note: Implements AbstractPlotData’s update_data() method. This method has the same signature as the dictionary update() method.

See also

set_data

Simpler interface to set only 1 entry at a time.

writable = True

Consumers can write data to this object (overrides AbstractPlotData).