class ContinuousColormap(*args, gamma=1, alpha=None, cyclic=False, **kwargs)[source]

Bases: LinearSegmentedColormap, _Colormap

Replacement for LinearSegmentedColormap.

  • segmentdata (dict-like) – Dictionary containing the keys 'red', 'green', 'blue', and (optionally) 'alpha'. The shorthands 'r', 'g', 'b', and 'a' are also acceptable. The key values can be callable functions that return channel values given a colormap index, or 3-column arrays indicating the coordinates and channel transitions. See matplotlib.colors.LinearSegmentedColormap for a detailed explanation.

  • name (str, default: '_no_name') – The colormap name. This can also be passed as the first positional string argument.

  • N (int, default: rc['image.lut'] = 256) – Number of points in the colormap lookup table.

  • gamma (float, optional) – Gamma scaling used for the x coordinates.

  • alpha (float, optional) – The opacity for the entire colormap. This overrides the input opacities.

  • cyclic (bool, optional) – Whether the colormap is cyclic. If True, this changes how the leftmost and rightmost color levels are selected, and extend can only be 'neither' (a warning will be issued otherwise).

Other Parameters

**kwargs – Passed to matplotlib.colors.LinearSegmentedColormap.

Methods Summary

append(*args[, ratios, name, N])

Return the concatenation of this colormap with the input colormaps.

copy([name, segmentdata, N, alpha, gamma, ...])

Return a new colormap with relevant properties copied from this one if they were not provided as keyword arguments.

cut([cut, name, left, right])

Return a version of the colormap with the center "cut out".

from_file(path, *[, warn_on_failure])

Load colormap from a file.

from_list(*args, **kwargs)

Make a ContinuousColormap from a sequence of colors.


Return a reversed copy of the colormap.

save([path, alpha])

Save the colormap data to a file.

set_alpha(alpha[, coords, ratios])

Set the opacity for the entire colormap or set up an opacity gradation.


Set whether this colormap is "cyclic".

shifted([shift, name])

Return a cyclicaly shifted version of the colormap.

to_discrete([samples, name])

Convert the ContinuousColormap to a DiscreteColormap by drawing samples from the colormap.

truncate([left, right, name])

Return a truncated version of the colormap.