scale-brewer

Discrete ColorBrewer colour/fill scale.

palette names a ColorBrewer set such as "Set1" or "Spectral".

Usage

scale-brewer(
  ..args,
)

Parameters

Parameter Default Description
..args Named arguments forwarded to the colour/fill scale (e.g. palette, name, limits, labels).

Returns

Deferred scale spec consumed by scales.

Examples

Colour groups with a discrete ColorBrewer palette.

#let d = ((x: 1, y: 1, g: "a"), (x: 2, y: 2, g: "b"), (x: 3, y: 3, g: "c"))
#plot(
  data: d,
  mapping: aes(x: "x", y: "y", colour: "g"),
  layers: (geom-point(size: 3pt),),
  scales: scales(colour: scale-brewer(palette: "Set1")),
  width: 10cm,
  height: 6cm,
)

Scatter chart of three points coloured by group with the ColorBrewer Set1 palette.

Scatter chart of three points coloured by group with the ColorBrewer Set1 palette.

See also

scales, scale-distiller, scale-fermenter.

Back to top