class LinearSegmentedColormap(name, segmentdata, N=None, gamma=1, cyclic=False, alpha=None)[source]

Bases: matplotlib.colors.LinearSegmentedColormap, proplot.colors._Colormap

New base class for all LinearSegmentedColormaps.

  • name (str) – The colormap name.

  • segmentdata (dict-like) – Mapping containing the keys 'hue', 'saturation', and 'luminance'. 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 LinearSegmentedColormap for a more detailed explanation.

  • N (int, optional) – Number of points in the colormap lookup table. Default is rc[‘image.lut’] = 256.

  • alpha (float, optional) – The opacity for the entire colormap. Overrides the input segment data.

  • 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).

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

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(name, colors[, ratios])

Make a LinearSegmentedColormap from a list of colors.


Return a reversed copy of the colormap, as in LinearSegmentedColormap.

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.


Convert the LinearSegmentedColormap to a ListedColormap by drawing samples from the colormap.

truncate([left, right, name])

Return a truncated version of the colormap.