scale-colour-okabe-ito
Discrete Okabe-Ito colour-vision-deficiency-safe colour scale.
Maps categorical levels to the eight-colour Okabe-Ito palette (Wong 2011, Nature Methods) in the order they first appear in the data. This palette is also the library default for unmapped discrete colour aesthetics; use this helper when you want to opt in explicitly or set name, limits, or labels.
Usage
scale-colour-okabe-ito(
name,
limits,
oob,
labels,
)Parameters
| Parameter | Default | Description |
|---|---|---|
name |
Legend title. Overrides any name set via labels when both are present. |
|
limits |
Array of level names controlling order and inclusion, or none. |
|
oob |
Out-of-range policy: "drop" (default) removes rows whose value falls outside limits; "squish" clamps continuous values to the nearest endpoint. |
|
labels |
Array of legend labels aligned with limits, or auto. |
Returns
Scale object consumed by plot.
Examples
Three categorical levels mapped to the first three Okabe-Ito hues.
#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-okabe-ito(),),
width: 10cm,
height: 6cm,
)See also
scale-fill-okabe-ito, scale-colour-brewer, scale-colour-discrete.