geocat.viz.util.truncate_colormap#
- geocat.viz.util.truncate_colormap(cmap, minval=0.0, maxval=1.0, n=256, name=None, force=True)#
Utility function that truncates a colormap. Registers the new colormap by name and returns the corresponding colormap object.
- Parameters:
cmap (
matplotlib.colors.Colormap
) – Colormap to be truncated.minval (
int
,float
) – Minimum normalized value to be used for truncation of the color map.maxval (
int
,float
) – Maximum normalized 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.force (
bool
, default= True
) – If False, a ValueError is raised if trying to overwrite an already registered name. True supports overwriting registered colormaps other than the builtin colormaps.
Examples
All usage examples are within the GeoCAT-Examples Gallery. To see more usage cases, search the function on the website.