Colormap

Colormap(*args, name=None, listmode='perceptual', filemode='continuous', discrete=False, cycle=None, save=False, save_kw=None, **kwargs)[source]

Generate, retrieve, modify, and/or merge instances of PerceptualColormap, ContinuousColormap, and DiscreteColormap.

Parameters
  • *args (colormap-spec) – Positional arguments that individually generate colormaps. If more than one argument is passed, the resulting colormaps are merged with append or append. The arguments are interpreted as follows:

  • name (str, optional) – Name under which the final colormap is registered. It can then be reused by passing cmap='name' to plotting functions. Names with leading underscores are ignored.

  • filemode ({'perceptual', 'continuous', 'discrete'}, optional) – Controls how colormaps are generated when you input list(s) of colors. The options are as follows:

    Default is 'continuous' when calling Colormap directly and 'discrete' when Colormap is called by Cycle.

  • listmode ({'perceptual', 'continuous', 'discrete'}, optional) – Controls how colormaps are generated when you input sequence(s) of colors. The options are as follows:

    Default is 'perceptual' when calling Colormap directly and 'discrete' when Colormap is called by Cycle.

  • samples (int or sequence of int, optional) – For ContinuousColormaps, this is used to generate DiscreteColormaps with to_discrete. For DiscreteColormaps, this is used to updates the number of colors in the cycle. If samples is integer, it applies to the final merged colormap. If it is a sequence of integers, it applies to each input colormap individually.

  • discrete (bool, optional) – If True, when the final colormap is a DiscreteColormap, we leave it alone, but when it is a ContinuousColormap, we always call to_discrete with a default samples value of 10. This argument is not necessary if you provide the samples argument.

  • left, right (float or sequence of float, optional) – Truncate the left or right edges of the colormap. Passed to truncate. If float, these apply to the final merged colormap. If sequence of float, these apply to each input colormap individually.

  • cut (float or sequence of float, optional) – Cut out the center of the colormap. Passed to cut. If float, this applies to the final merged colormap. If sequence of float, these apply to each input colormap individually.

  • reverse (bool or sequence of bool, optional) – Reverse the colormap. Passed to reversed. If float, this applies to the final merged colormap. If sequence of float, these apply to each input colormap individually.

  • shift (float or sequence of float, optional) – Cyclically shift the colormap. Passed to shifted. If float, this applies to the final merged colormap. If sequence of float, these apply to each input colormap individually.

  • a – Shorthand for alpha.

  • alpha (float or color-spec or sequence, optional) – The opacity of the colormap or the opacity gradation. Passed to proplot.colors.ContinuousColormap.set_alpha or proplot.colors.DiscreteColormap.set_alpha. If float, this applies to the final merged colormap. If sequence of float, these apply to each colormap individually.

  • h, s, l, c – Shorthands for hue, luminance, saturation, and chroma.

  • hue, saturation, luminance (float or color-spec or sequence, optional) – The channel value(s) used to generate colormaps with from_hsl and from_color.

    • If you provided no positional arguments, these are used to create an arbitrary perceptually uniform colormap with from_hsl. This is an alternative to passing a dictionary as a positional argument with hue, saturation, and luminance as dictionary keys (see args).

    • If you did provide positional arguments, and any of them are color specifications, these control the look of monochromatic colormaps generated with from_color. To use different values for each colormap, pass a sequence of floats instead of a single float. Note the default luminance is 90 if discrete is True and 100 otherwise.

  • chroma – Alias for saturation.

  • cycle (str, optional) – The registered cycle name used to interpret cycle color strings like 'C0' and 'C2'. Default is from the active property cycler. This lets you make monochromatic colormaps using colors selected from arbitrary property cycles.

  • save (bool, optional) – Whether to call the colormap/color cycle save method, i.e. proplot.colors.ContinuousColormap.save or proplot.colors.DiscreteColormap.save.

  • save_kw (dict-like, optional) – Ignored if save is False. Passed to the colormap/color cycle save method, i.e. proplot.colors.ContinuousColormap.save or proplot.colors.DiscreteColormap.save.

Other Parameters

**kwargs – Passed to proplot.colors.ContinuousColormap.copy, proplot.colors.PerceptualColormap.copy, or proplot.colors.DiscreteColormap.copy.

Returns

matplotlib.colors.Colormap – A ContinuousColormap or DiscreteColormap instance.