scale-fill-brewer
Discrete ColorBrewer fill scale.
Fill counterpart of scale-colour-brewer. Same palette names apply.
Usage
scale-fill-brewer(
..args,
)Parameters
| Parameter | Default | Description |
|---|---|---|
..args |
Returns
Scale object consumed by plot.
Examples
Set1 palette filling categorical bars.
#let d = (
(grp: "a", y: 1),
(grp: "b", y: 2),
(grp: "c", y: 3),
)
#plot(
data: d,
mapping: aes(x: "grp", y: "y", fill: "grp"),
layers: (geom-col(),),
scales: (scale-fill-brewer(palette: "Set1"),),
width: 10cm,
height: 6cm,
)The Spectral palette laid out as a swatch strip via geom-rect.
#let levels = ("a", "b", "c", "d", "e", "f", "g")
#let d = levels.enumerate().map(((i, k)) => (
xmin: i, xmax: i + 1, ymin: 0, ymax: 1, k: k,
))
#plot(
data: d,
mapping: aes(xmin: "xmin", xmax: "xmax", ymin: "ymin", ymax: "ymax", fill: "k"),
layers: (geom-rect(),),
scales: (scale-fill-brewer(palette: "Spectral"),),
guides: guides(fill: guide-none()),
width: 8cm,
height: 1cm,
)