Post · 1 min read· pp. 961–962

aerosandbox.tools.pretty_plots.colors

Attributes

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()

Module Contents

aerosandbox.tools.pretty_plots.colors.palettes

aerosandbox.tools.pretty_plots.colors.get_discrete_colors_from_colormap(cmap='rainbow', N=8, lower_bound=0, upper_bound=1) : 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.

code
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) : Converts a color to HLS space, then multiplies the lightness by amount, then converts back to RGB.

code
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()