class_cmap

mcalf.utils.plot.class_cmap(style, n)[source]

Create a listed colormap for a specific number of classifications.

Parameters:
  • style (str) – The named matplotlib colormap to extract a ListedColormap from. Colours are selected from vmin to vmax at equidistant values in the range [0, 1]. The ListedColormap produced will also show bad classifications and classifications out of range in grey. The ‘original’ style is a special case used since early versions of this code. It is a hardcoded list of 5 colours. When the number of classifications exceeds 5, style='viridis' will be used.

  • n (int) – Number of colours (i.e., number of classifications) to include in the colormap.

Returns:

cmap – Colormap generated for classifications.

Return type:

matplotlib.colors.ListedColormap