scale-colour-manual
Manual discrete colour scale: supply the colour array directly.
Colours cycle through values in the order levels appear, unless limits fixes the level order.
Usage
scale-colour-manual(
..args,
)Parameters
| Parameter | Default | Description |
|---|---|---|
..args |
Returns
Scale object consumed by plot.
Examples
Hand-picked colour array applied to three categorical levels.
#let d = (
(x: 1, y: 2, sp: "a"),
(x: 2, y: 4, sp: "b"),
(x: 3, y: 3, sp: "c"),
)
#plot(
data: d,
mapping: aes(x: "x", y: "y", colour: "sp"),
layers: (geom-point(size: 3pt),),
scales: (scale-colour-manual(values: (
rgb("#1b9e77"), rgb("#d95f02"), rgb("#7570b3"),
)),),
width: 10cm,
height: 6cm,
)limits fixes the level order independently of how rows appear in the data, useful for stable legends across datasets.
#let d = (
(x: 1, y: 2, sp: "c"),
(x: 2, y: 4, sp: "a"),
(x: 3, y: 3, sp: "b"),
)
#plot(
data: d,
mapping: aes(x: "x", y: "y", colour: "sp"),
layers: (geom-point(size: 3pt),),
scales: (scale-colour-manual(
values: (rgb("#1b9e77"), rgb("#d95f02"), rgb("#7570b3")),
limits: ("a", "b", "c"),
),),
width: 10cm,
height: 6cm,
)