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


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

The format of fields is:

[ (fieldName, {options}), ... ]

Field Options:


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).


String indicating the units of the data for this field.


List of unique values for which the user may assign a color when mode==’enum’. Optionally may specify a dict instead {value: name}.


Dict of default values to apply to color map items when they are created. Valid keys are ‘colormap’ to provide a default color map, or otherwise they a string or tuple indicating the parameter to be set, such as ‘Operation’ or (‘Channels..’, ‘Red’)., mode='byte')

Return an array of colors corresponding to data.



A numpy record array where the fields in data.dtype match those defined by a prior call to setFields().


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.


Add a new color mapping and return the created parameter.