ColorMapWidget

class pyqtgraph.ColorMapWidget(parent=None)[source]

This class provides a widget allowing the user to customize color mapping for multi-column data. Given a list of field names, the user may specify multiple criteria for assigning colors to each record in a numpy record array. Multiple criteria are evaluated and combined into a single color for each record by user-defined compositing methods.

For simpler color mapping using a single gradient editor, see GradientWidget

__init__(parent=None)[source]
ColorMapParameter.setFields(fields)

Set the list of fields to be used by the mapper.

The format of fields is:

[ (fieldName, {options}), ... ]
Field Options:  
mode Either ‘range’ or ‘enum’ (default is range). For ‘range’, The user may specify a gradient of colors to be applied linearly across a specific range of values. For ‘enum’, the user specifies a single color for each unique value (see values option).
units String indicating the units of the data for this field.
values List of unique values for which the user may assign a color when mode==’enum’. Optionally may specify a dict instead {value: name}.
ColorMapParameter.map(data, mode='byte')

Return an array of colors corresponding to data.

Arguments:  
data A numpy record array where the fields in data.dtype match those defined by a prior call to setFields().
mode Either ‘byte’ or ‘float’. For ‘byte’, the method returns an array of dtype ubyte with values scaled 0-255. For ‘float’, colors are returned as 0.0-1.0 float values.