colormap: Apply colormap to array

This module provides cmap() which applies a colormap to a dataset.

cmap(data, colors, double vmin, double vmax, normalization=u'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 (Union[str,Normalization]) –

    Either a Normalization instance or a str in:

    • ’linear’ (default)

    • ’log’

    • ’arcsinh’

    • ’sqrt’

    • ’gamma’

  • 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