Skip to content

Data viz

Matplotlib Colors (Python)

Matplotlib accepts HEX strings, normalized RGB tuples, and named CSS colors in pyplot, axes, and colormap definitions. Spec reference: Documentation.

Open color converter →

Starter template

import matplotlib.pyplot as plt

plt.plot(x, y, color="#7c3aed")
plt.scatter(x, y, c=(0.49, 0.23, 0.93))
plt.show()

Color samples

FAQ

Named CSS colors vs HEX?

Named colors (rebeccapurple) are convenient in notebooks. HEX and tuples are explicit for publications and brand guidelines.

RGBA tuples for transparency?

Use a fourth value in (r, g, b, a) with a between 0 and 1 for overlays and confidence bands.

Can I copy the syntax chips?

Yes — click the secondary chip to copy platform syntax. HEX and RGB chips copy sRGB values for mockups, design handoff, and ChromaXP tools.

Are RGB and CMYK print-ready?

RGB and CMYK here are computed from HEX for quick reference. For ink and paper, re-check against your print profile or Pantone bridge.