chaco.plots.colormapped_scatterplot module

Defines the ColormappedScatterPlot and ColormappedScatterPlotView classes.

class chaco.plots.colormapped_scatterplot.ColormappedScatterPlot(**kwtraits)

Bases: chaco.plots.scatterplot.ScatterPlot

A scatter plot that allows each point to take on a different color, corresponding to a color map.

If the color_data or color_mapper attributes are None, then it behaves like a normal ScatterPlot.

color_data = Instance(ArrayDataSource)

Source for color data.

color_mapper = Instance(AbstractColormap)

Mapping for colors.

fill_alpha = Float(1.0)

The alpha value to apply to the result of the color-mapping process. (This makes it easier to create color maps without having to worry about alpha.)


Maps an array of data points into screen space, and returns them as an array.

The data_array parameter must be an Nx2 (index, value) or Nx3 (index, value, color_value) array. The returned array is an Nx2 array of (x, y) tuples.

render_method = Enum("auto", "banded", "bruteforce")

Determines what drawing approach to use:


Draw the points color-band by color-band, thus reducing the number of set_stroke_color() calls. Disadvantage is that some colors will appear more prominently than others if there are a lot of overlapping points.


Set the stroke color before drawing each marker. Slower, but doesn’t produce the banding effect that puts some colors on top of others; useful if there is a lot of overlap of the data.


Determines which render method to use based on the number of points

TODO: Based on preliminary results, “banded” isn’t significantly more expensive than “bruteforce” for small datasets (<1000), so perhaps banded should be removed.


TraitsUI View for customizing the plot. Overrides the ScatterPlot value.

class chaco.plots.colormapped_scatterplot.ColormappedScatterPlotView

Bases: chaco.plots.scatterplot.ScatterPlotView

TraitsUI View for customizing a color-mapped scatter plot.