mdciao.plots.color_dict_guesser

mdciao.plots.color_dict_guesser(colors, keys)

Helper function to construct a color dictionary from user input

Parameters:
  • colors (None, str, list or dict) –

    • None: use the first n “tab10” colors, where n is determined by keys. If len(keys) > 10, use “tab20”.

    • str: name of the matplotlib colormap to interpolate to n colors. Can be qualitative like “Set2” or “tab20” or quantitative like “viridis” or “Reds”. For more info see: https://matplotlib.org/stable/tutorials/colors/colormaps.html If a string is explicitly provided, e.g. “tab10”, then the “tab10” colors will be repeated as many times needed to cover all keys

    • list: list of colors ([“r”,”g”,”b”]) Turn this list into a dictionary keyed with keys

  • keys (int or list) – If int, create a list of keys = _np.arange(keys). If list, use that list directly as keys for the color dictionary that will be returned

Returns:

colors

Return type:

dict