ColorMap.from_mpl

classmethod ColorMap.from_mpl(name)[source]

Construct a color map from matplotlib.

Parameters:
nameLiteral[‘magma’, ‘inferno’, ‘plasma’, ‘viridis’]

The name of the mpl colormap.

Returns:
compas.colors.ColorMap

A color map with 256 colors.

Raises:
KeyError

If the color is not available.

Notes

The palettes available through this function are from BIDS/colormap, but with the dependency on matplotlib removed to ensure compatibility with RhinoGH. See compas/colors/mpl_colormap.py for more info and license information.