matplotlib.colors.MultivarColormap#
- class matplotlib.colors.MultivarColormap(colormaps, combination_mode, name='multivariate colormap')[source]#
Bases:
objectClass for holding multiple
Colormapfor use in aScalarMappableobject- Parameters:
- colormapslist or tuple of
Colormapobjects The individual colormaps that are combined
- combination_modestr, 'sRGB_add' or 'sRGB_sub'
Describe how colormaps are combined in sRGB space
If 'sRGB_add' -> Mixing produces brighter colors
sRGB = sum(colors)If 'sRGB_sub' -> Mixing produces darker colors
sRGB = 1 - sum(1 - colors)
- namestr, optional
The name of the colormap family.
- colormapslist or tuple of
- __call__(X, alpha=None, bytes=False, clip=True)[source]#
- Parameters:
- Xtuple (X0, X1, ...) of length equal to the number of colormaps
X0, X1 ...: float or int,
ndarrayor scalar The data value(s) to convert to RGBA. For floats, Xi... should be in the interval[0.0, 1.0]to return the RGBA valuesX*100percent along the Colormap line. For integers, Xi... should be in the interval[0, self[i].N)to return RGBA values indexed from colormap [i] with indexXi, where self[i] is colormap i.- alphafloat or array-like or None
Alpha must be a scalar between 0 and 1, a sequence of such floats with shape matching Xi, or None.
- bytesbool, default: False
If False (default), the returned RGBA values will be floats in the interval
[0, 1]otherwise they will benumpy.uint8s in the interval[0, 255].- clipbool, default: True
If True, clip output to 0 to 1
- Returns:
- Tuple of RGBA values if X[0] is scalar, otherwise an array of
- RGBA values with a shape of
X.shape + (4, ).
- property combination_mode#
- with_extremes(*, bad=None, under=None, over=None)[source]#
Return a copy of the
MultivarColormapwith modified out-of-range attributes.The bad keyword modifies the copied
MultivarColormapwhile under and over modifies the attributes of the copied component colormaps. Note that under and over colors are subject to the mixing rules determined by the combination_mode.- Parameters:
- badcolor, default: None
If Matplotlib color, the bad value is set accordingly in the copy
- undertuple of color, default: None
If tuple, the 'under' value of each component is set with the values from the tuple.
- overtuple of color, default: None
If tuple, the 'over' value of each component is set with the values from the tuple.
- Returns:
- MultivarColormap
copy of self with attributes set