chaco.point_data_source module

Defines the PointDataSource class.

class chaco.point_data_source.PointDataSource(data=array([], shape=(0, 2), dtype=float64), **kw)

Bases: chaco.array_data_source.ArrayDataSource

A data source representing a (possibly unordered) set of (X,Y) points.

This is internally always represented by an Nx2 array, so that data[i] refers to a single point (represented as a length-2 array).

Most of the traits and methods of ArrayDataSeries work for the PointDataSeries as well, since its data is linear. This class overrides only the methods and traits that are different.


Returns the data for this data source, or (0.0, 0.0) if it has no data.

Overrides ArryDataSource.

index_dimension = ReadOnly("scalar")

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

reverse_map(pt, index=0, outside_returns_none=True)

Returns the index of pt in the data source.

Overrides ArrayDataSource.

  • pt ((x, y)) – value to find

  • index (0 or 1) – Which of the axes of pt the sort_order refers to.

  • outside_returns_none (Boolean) – Whether the method returns None if pt is outside the range of the data source; if False, the method returns the value of the bound that pt is outside of, in the index dimension.

sort_index = Enum(0, 1)

Which of the value axes the sort_order refers to. If sort_order is ‘none’, this attribute is ignored. In the unlikely event that the value data is sorted along both X and Y (i.e., monotonic in both axes), then set sort_index to whichever one has the best binary-search performance for hit-testing.

sort_order = SortOrderTrait

The sort order of the data. Although sort order is less common with point data, it can be useful in case where the value data is sorted along some axis. Note that sort_index is used only if sort_order is not ‘none’.

value_dimension = ReadOnly("point")

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