colormap
: Apply colormap to array¶
This module provides cmap()
which applies a colormap to a dataset.
-
silx.math.colormap.
cmap
(data, colors, double vmin, double vmax, str normalization='linear', nan_color=None)¶ Convert data to colors with provided colors look-up table.
Parameters: - data (numpy.ndarray) – The input data
- colors (numpy.ndarray) – Color look-up table as a 2D array. It MUST be of type uint8 or float32
- vmin – Data value to map to the beginning of colormap.
- vmax – Data value to map to the end of the colormap.
- normalization (str) –
The normalization to apply:
- ‘linear’ (default)
- ‘log’
- ‘arcsinh’
- ‘sqrt’
- nan_color – Color to use for NaN value. Default: A color with all channels set to 0
Returns: Array of colors. The shape of the returned array is that of data array + the last dimension of colors. The dtype of the returned array is that of the colors array.
Return type: numpy.ndarray