aerosandbox.tools.pretty_plots.colors#

Module Contents#

Functions#

get_discrete_colors_from_colormap([cmap, N, ...])

Returns uniformly-spaced discrete color samples from a (continuous) colormap.

adjust_lightness(color[, amount])

Converts a color to HLS space, then multiplies the lightness by amount, then converts back to RGB.

get_last_line_color()

Attributes#

aerosandbox.tools.pretty_plots.colors.palettes[source]#
aerosandbox.tools.pretty_plots.colors.get_discrete_colors_from_colormap(cmap='rainbow', N=8, lower_bound=0, upper_bound=1)[source]#

Returns uniformly-spaced discrete color samples from a (continuous) colormap. :param cmap: Name of a colormap. :param N: Number of colors to retrieve from colormap.

Returns: A Nx4 array of (R, G, B, A) colors.

Parameters:
  • cmap (str) –

  • N (int) –

  • lower_bound (float) –

  • upper_bound (float) –

aerosandbox.tools.pretty_plots.colors.adjust_lightness(color, amount=1.0)[source]#

Converts a color to HLS space, then multiplies the lightness by amount, then converts back to RGB.

Parameters:
  • color – A color, in any format that matplotlib understands.

  • amount – The amount to multiply the lightness by. Valid range is 0 to infinity.

Returns: A color, as an RGB tuple.

aerosandbox.tools.pretty_plots.colors.get_last_line_color()[source]#