matplotlib.colors.to_rgba_array(c, alpha=None)[source]

Convert c to a (n, 4) array of RGBA colors.

cMatplotlib color or array of colors

If c is a masked array, an ndarray is returned with a (0, 0, 0, 0) row for each masked value or row in c.

alphafloat or sequence of floats, optional

If alpha is not None, it forces the alpha value, except if c is "none" (case-insensitive), which always maps to (0, 0, 0, 0). If alpha is a sequence and c is a single color, c will be repeated to match the length of alpha.


(n, 4) array of RGBA colors.

Examples using matplotlib.colors.to_rgba_array