lair.plotter.truncate_colormap#

lair.plotter.truncate_colormap(cmap, minval=0.0, maxval=1.0, n=100)[source]#

Truncate matplotlib colormaps using min and max vals from 0 to 1, and then linearly build a new colormap

Parameters:
  • cmap (str | matplotlib.colors.Colormap) – Colormap to be truncated.

  • minval (float, optional) – Minimum value to truncate the colormap. Defaults to 0.0.

  • maxval (float, optional) – Maximum value to truncate the colormap. Defaults to 1.0.

  • n (int, optional) – Number of colors in the new colormap. Defaults to 100.

Returns:

matplotlib.colors.LinearSegmentedColormap – Truncated colormap.

Return type:

LinearSegmentedColormap