LinearSegmentedColormap¶
- class LinearSegmentedColormap(name, segmentdata, N=None, gamma=1, cyclic=False, alpha=None)[source]¶
Bases:
matplotlib.colors.LinearSegmentedColormap,proplot.colors._ColormapNew base class for all
LinearSegmentedColormaps.- Parameters
name (str) – The colormap name.
segmentdata (dict-like) – Dictionary containing the keys
'red','blue','green', 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. Seematplotlib.colors.LinearSegmentedColormapfor a detailed explanation.N (int, optional) – Number of points in the colormap lookup table. Default is
rc[‘image.lut’]=256.gamma (float, optional) – Gamma scaling used for the x coordinates.
alpha (float, optional) – The opacity for the entire colormap. This 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, andextendcan only be'neither'(a warning will be issued otherwise).
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
LinearSegmentedColormapfrom a list of colors.reversed([name])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_cyclic(b)Set whether this colormap is “cyclic”.
shifted([shift, name])Return a cyclicaly shifted version of the colormap.
to_listed([samples, name])Convert the
LinearSegmentedColormapto aListedColormapby drawing samples from the colormap.truncate([left, right, name])Return a truncated version of the colormap.