sid.colors

Copied from the utilities package from the Covid Impact Lab.

https://github.com/covid-19-impact-lab/utilities/blob/master/utilities/colors.py.””

Module Contents

Functions

get_colors(palette, number, as_cmap=False, skip_dark=0, skip_bright=0)

Return a list with hex codes representing a color palette.

_get_mono_colors(palette, number, skip_dark, skip_bright)

plot_colors(palette, number, skip_dark=0, skip_bright=0, size=1)

Plot a color palette.

_mono_list_to_triangle(mono_list)

Attributes

get_colors(palette, number, as_cmap=False, skip_dark=0, skip_bright=0)[source]

Return a list with hex codes representing a color palette.

Parameters
  • palette (str) – One of [“categorical”, “ordered”, “blue”, “red”, “yellow”, “green”, “orange”, “purple”] or combinations of two colors, e.g. “red-green”.

  • number (int) – Number of colors needed. Between 1 and 12 for non combined color scales and between 1 and 24 for combined color scales.

  • as_cmap (bool) – If True, the result is returned as matplotlib cmap.

  • skip_dark (int) – How many colors to skip from the dark side. Only available for monochrome and combined color palettes.

  • skip_bright (int) – How many colors to skip from the bright side. Only available for monochrome and combined color palettes.

Returns

List of hex codes or cmap.

Return type

list or cmap

_get_mono_colors(palette, number, skip_dark, skip_bright)[source]
plot_colors(palette, number, skip_dark=0, skip_bright=0, size=1)[source]

Plot a color palette.

Parameters
  • palette (str) – One of [“categorical”, “ordered”, “blue”, “red”, “yellow”, “green”, “orange”, “purple”]

  • number (int) – Between 1 and 12.

  • size (float) – Scaling factor for the plot size.

_mono_list_to_triangle(mono_list)[source]
CAT_LIST = ['#547482', '#C87259', '#F1B05D', '#818662', '#C2D8C2', '#6C4A4D', '#7A8C87', '#EE8445',...[source]
ORDERED[source]
MONO_COLORS[source]