ColorMap(pos, color, mode=None, mapping=None)¶
A ColorMap defines a relationship between a scalar value and a range of colors. ColorMaps are commonly used for false-coloring monochromatic images, coloring scatter-plot points, and coloring surface plots by height.
Each color map is defined by a set of colors, each corresponding to a particular scalar value. For example:0.0 -> black0.2 -> red0.6 -> yellow1.0 -> white
The colors for intermediate values are determined by interpolating between the two nearest colors in either RGB or HSV color space.
To provide user-defined color mappings, see
__init__(pos, color, mode=None, mapping=None)¶
Arguments: pos Array of positions where each color is defined color Array of colors. Values are interpreted via
mode Array of color modes (ColorMap.RGB, HSV_POS, or HSV_NEG) indicating the color space that should be used when interpolating between stops. Note that the last mode value is ignored. By default, the mode is entirely RGB. mapping Mapping mode (ColorMap.CLIP, REPEAT, MIRROR, or DIVERGING) controlling mapping of relative index to color. CLIP maps colors to [0.0;1.0] REPEAT maps colors to repeating intervals [0.0;1.0];[1.0-2.0],… MIRROR maps colors to [0.0;-1.0] and [0.0;+1.0] identically DIVERGING maps colors to [-1.0;+1.0]
Retrieve palette QColor by index
Return list of all color stops converted to the specified mode. If mode is None, then no conversion is done.
Return a QLinearGradient object spanning from QPoints p1 to p2.
getLookupTable(start=0.0, stop=1.0, nPts=512, alpha=None, mode='byte')¶
Return an RGB(A) lookup table (ndarray).
Arguments: start The starting value in the lookup table (default=0.0) stop The final value in the lookup table (default=1.0) nPts The number of points in the returned lookup table. alpha True, False, or None - Specifies whether or not alpha values are included in the table. If alpha is None, it will be automatically determined. mode Determines return type: ‘byte’ (0-255), ‘float’ (0.0-1.0), or ‘qcolor’. See
Return True if the gradient has exactly two stops in it: black at 0.0 and white at 1.0.
Return an array of colors corresponding to the values in data. Data must be either a scalar position or an array (any shape) of positions.
The mode argument determines the type of data returned:
byte (default) Values are returned as 0-255 unsigned bytes. float Values are returned as 0.0-1.0 floats. qcolor Values are returned as an array of QColor objects.
Return True if any stops have an alpha < 255