pyrolite.plot.color

pyrolite.plot.color.get_cmode(c=None)[source]

Find which mode a color is supplied as, such that it can be processed.

Parameters

c (str | list | tuple | numpy.ndarray) – Color arguments as typically passed to matplotlib.pyplot.scatter() or matplotlib.pyplot.plot().

pyrolite.plot.color.process_color(c=None, color=None, cmap=None, alpha=None, norm=None, bad='0.5', cmap_under=(1, 1, 1, 0.0), color_converter=<function to_rgba>, color_mappings={}, size=None, **otherkwargs)[source]

Color argument processing for pyrolite plots, returning a standardised output.

Parameters
  • c (str | list | tuple | numpy.ndarray) – Color arguments as typically passed to matplotlib.pyplot.scatter().

  • color (str | list | tuple | numpy.ndarray) – Color arguments as typically passed to matplotlib.pyplot.plot()

  • cmap (str | ScalarMappable) – Colormap for mapping unknown color values.

  • alpha (float) – Alpha to modulate color opacity.

  • norm (Normalize) – Normalization for the colormap.

  • cmap_under (str | tuple) – Color for values below the lower threshold for the cmap.

  • color_converter – Function to use to convert colors (from strings, hex, tuples etc).

  • color_mappings (dict) – Dictionary containing category-color mappings for individual color variables, with the default color mapping having the key ‘color’. For use where categorical values are specified for a color variable.

  • size (int) – Size of the data array along the first axis.

Returns

C – Color returned in standardised RGBA format.

Return type

tuple | numpy.ndarray

Notes

As formulated here, the addition of unused styling parameters may cause some properties (associated with ‘c’) to be set to None - and hence revert to defaults. This might be mitigated if the context could be checked - e.g. via checking keyword argument membership of scatterkwargs() etc.