scale-colour-distiller

Continuous ColorBrewer colour scale.

Looks up a Brewer palette by name and interpolates linearly across its stops as a continuous ramp. direction flips the palette: 1 keeps the canonical order, -1 reverses it.

Usage

scale-colour-distiller(
  ..args,
)

Parameters

Parameter Default Description
..args

Returns

Scale object consumed by plot.

Examples

Spectral palette interpolated as a continuous ramp.

#let d = range(0, 12).map(i => (x: i, y: i, z: i * 0.5))
#plot(
  data: d,
  mapping: aes(x: "x", y: "y", colour: "z"),
  layers: (geom-point(size: 3pt),),
  scales: (scale-colour-distiller(palette: "Spectral"),),
  width: 10cm,
  height: 6cm,
)

Scatter chart of twelve diagonal points coloured by z along the ColorBrewer Spectral palette lifted into a smooth continuous ramp from red through yellow to blue.

Scatter chart of twelve diagonal points coloured by z along the ColorBrewer Spectral palette lifted into a smooth continuous ramp from red through yellow to blue.

Set direction: -1 to reverse the palette so high values map to the canonical low end.

#let d = range(0, 12).map(i => (x: i, y: i, z: i * 0.5))
#plot(
  data: d,
  mapping: aes(x: "x", y: "y", colour: "z"),
  layers: (geom-point(size: 3pt),),
  scales: (scale-colour-distiller(palette: "Blues", direction: -1),),
  width: 10cm,
  height: 6cm,
)

Scatter chart of twelve diagonal points coloured by z along a reversed Blues distiller ramp so high values appear pale and low values dark blue.

Scatter chart of twelve diagonal points coloured by z along a reversed Blues distiller ramp so high values appear pale and low values dark blue.

See also

scale-fill-distiller, scale-colour-gradientn, scale-colour-brewer.

Back to top