Colour and encodings

Map data to colour, size, shape, opacity, and line style.

Scales decide how a data column becomes a visual property; getting them right is most of what makes a chart readable. Use a colour-vision-deficiency-safe palette such as Okabe-Ito for categories, a perceptually uniform ramp such as Viridis for continuous values, and a diverging gradient only when the data has a meaningful midpoint. Beyond colour, these examples map size, shape, opacity, stroke, and line style, and show manual and binned variants of each family. See the accessibility guide for the reasoning behind these defaults. Every example ships its full source: click View source to copy it.

Back to top