geocat.viz.truncate_colormap

geocat.viz.truncate_colormap(cmap, minval=0.0, maxval=1.0, n=100, name=None)

Utility function that truncates a colormap. Registers the new colormap by name in plt.cm, and also returns the updated map.

Copied from Stack Overflow

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

  • minval (int or float) – Minimum value to be used for truncation of the color map.

  • maxval (int or float) – Maximum value to be used for truncation of the color map.

  • n (int) – Number of color values in the new color map.

  • name (str) – Optional name of the new color map. If not set, a new name is generated by using the name of the input colormap as well as min and max values.

Examples

All usage examples are within the GeoCAT-Examples Gallery. To see more usage cases, search the function on the website.