scale-colour-fermenter

Binned ColorBrewer colour scale.

Looks up a Brewer palette by name, interpolates across its stops, and quantises the lookup into n-breaks equal-width bins. direction flips the palette: 1 keeps the canonical order, -1 reverses it.

Usage

scale-colour-fermenter(
  ..args,
)

Parameters

Parameter Default Description
..args

Returns

Scale object consumed by plot.

Examples

Spectral palette quantised into five bins.

#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-fermenter(palette: "Spectral", n-breaks: 5),),
  width: 10cm,
  height: 6cm,
)

Scatter chart of twelve diagonal points where z is cut into five stepped bands along the ColorBrewer Spectral palette running red through yellow to blue.

Scatter chart of twelve diagonal points where z is cut into five stepped bands along the ColorBrewer Spectral palette running red through yellow to blue.

Sequential blues palette reversed via direction: -1 for an inverted banding.

#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-fermenter(
    palette: "Blues",
    direction: -1,
    n-breaks: 7,
  ),),
  width: 10cm,
  height: 6cm,
)

Scatter chart of twelve diagonal points where z is cut into seven stepped bands along a reversed Blues fermenter palette so high values appear pale and low dark blue.

Scatter chart of twelve diagonal points where z is cut into seven stepped bands along a reversed Blues fermenter palette so high values appear pale and low dark blue.

See also

scale-colour-distiller, scale-fill-fermenter.

Back to top