arctichoke.plot.diverging_cmap

Functions

make_diverging_cmap(cmin, cmax[, cmid, ncolors, verbose])

Create a diverging colormap where the selected middle value is always white.

Module Contents

arctichoke.plot.diverging_cmap.make_diverging_cmap(cmin: int, float, cmax: int, float, cmid: int, float = 0, ncolors: int = 256, verbose: bool = False, **kwargs)

Create a diverging colormap where the selected middle value is always white.

Make a custom diverging blue-white-red colormap with the given maximum and mininmum values, adjusted such that the selected middle value is white and the shorter end is cut off in color if the two ranges on either side of the middle value are uneven to preserve visual value perception.

Parameters:
  • cmin (int, float) – The minimum value for the colormap.

  • cmax (int, float) – The maximum value for the colormap.

  • cmid (int, float, optional) – The middle value at which the colormap should be white. Default is 0.

  • ncolors (int, optional) – The number of colors to use in the colormap. Default is 256.

  • verbose (bool, optional) – Whether to verbosely output information as the function executes. Default is False.

  • **kwargs – Keyword arguments to pass to bokeh.palettes.diverging_palette().

Returns:

diverging_cmap – The colors of the diverging colormap with a length of ncolors.

Return type:

tuple

Examples

>>> from arctichoke.plot.diverging_cmap import make_diverging_cmap