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,
)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,
)