chaco.transform_color_mapper module¶
-
class
chaco.transform_color_mapper.
TransformColorMapper
(segmentdata, **kwtraits)¶ Bases:
chaco.color_mapper.ColorMapper
This class adds arbitrary data transformations to a ColorMapper.
The default ColorMapper is basically a linear mapper from data space to color space. A TransformColorMapper allows a nonlinear mapper to be created.
A ColorMapper works by linearly transforming the data from data space to the unit interval [0,1], and then linearly mapping that interval to the color space.
A TransformColorMapper allows an arbitrary transform to be inserted at two places in this process. First, an initial transformation, data_func can be applied to the data before is it mapped to [0,1]. Then another function, unit_func, can be applied to the transformed data on [0,1] before it is mapped to color space. Normally, a unit_func is map of the unit interval [0,1] to itself (e.g. x^2 or sin(pi*x/2)).
-
classmethod
factory_from_color_map
(color_map, data_func=None, unit_func=None, **traits)¶ Create a TransformColorMapper factory function from a standard colormap factory function.
WARNING: This function is untested; I realized I didn’t need it shortly after writing it, so I haven’t tried it yet. –WW
-
classmethod
from_color_map
(color_map, data_func=None, unit_func=None, **traits)¶ Create a TransformColorMapper from a colormap generator function.
The return value is an instance of TransformColorMapper, not a factory function, so this does not provide a direct replacement for a standard colormap factory function. For that, use the class method TransoformColorMapper.factory_from_color_map().
-
classmethod
from_color_mapper
(color_mapper, data_func=None, unit_func=None, **traits)¶ Create a TransformColorMapper from an existing ColorMapper instance.
-
map_index
(data_array)¶ Maps an array of values to their corresponding color band index.
-
map_screen
(data_array)¶ Maps an array of data values to an array of colors.
-
map_uint8
(data_array)¶ Maps an array of data values to an array of colors.
-
classmethod