plots.styles.colors

Submodules

Functions

cmap_and_norm(colors, levels[, normalize, extend, ...])

Generate a colormap and a norm from a list of colours and levels.

contour_line_colors(colors, levels)

Generate a list of colours from a matplotlib colormap name and some levels.

expand(colors, levels[, extend_colors])

Generate a list of colours from a matplotlib colormap name and some levels.

gradients(levels, colors, gradients, normalize, **kwargs)

Generate a colormap with a specified number of gradients between levels.

magics_colors_to_rgb(colors)

Convert a list of Magics colours to RGB.

Package Contents

plots.styles.colors.cmap_and_norm(colors, levels, normalize=True, extend=None, extend_levels=True)

Generate a colormap and a norm from a list of colours and levels.

Parameters:
  • colors (str or list) – The name of a matplotlib colormap or a list of colours.

  • levels (list) – The levels for which to generate colours.

  • normalize (bool, optional) – Whether to normalize the colors.

  • extend (str, optional) – Whether to extend the colormap. Options are “both”, “min”, “max” or None.

  • extend_levels (bool, optional) – Whether to extend the levels. If False, the levels will be used as is. If True, the levels will be extended to include the under and over values.

plots.styles.colors.contour_line_colors(colors, levels)

Generate a list of colours from a matplotlib colormap name and some levels.

Parameters:
  • colors (str or list) – The name of a matplotlib colormap or a list of colours.

  • levels (list) – The levels for which to generate colours.

plots.styles.colors.expand(colors, levels, extend_colors=0)

Generate a list of colours from a matplotlib colormap name and some levels.

Parameters:
  • colors (str or list) – The name of a matplotlib colormap or a list of colours.

  • levels (list) – The levels for which to generate colours.

  • extend_colors (int, optional) – The number of colours to add to the colormap. Useful for extending the colormap to include under and over colours.

plots.styles.colors.gradients(levels, colors, gradients, normalize, **kwargs)

Generate a colormap with a specified number of gradients between levels.

Parameters:
  • levels (list) – The levels for which to generate colours.

  • colors (list) – The colours to use for the levels.

  • gradients (int or list) – The number of gradients between each level.

  • normalize (bool) – Whether to normalize the colours.

  • **kwargs – Additional keyword arguments to pass to the colormap.

plots.styles.colors.magics_colors_to_rgb(colors)

Convert a list of Magics colours to RGB.

Parameters:

colors (list) – A list of Magics colours.

Returns:

A list of RGB colours.

Return type:

list