label-both
Labeller showing both the variable name and the level.
Produces a label of the form "<variable>: <level>", e.g., "cyl: 6".
Usage
label-both(
separator: ": ",
)Parameters
| Parameter | Default | Description |
|---|---|---|
separator |
": " |
Separator between the variable name and the level. |
Returns
Labeller dictionary consumed by facet-wrap and facet-grid.
Examples
Strip shows the variable name and level ("sp: a", "sp: b").
#let d = ()
#for sp in ("a", "b") {
for i in range(0, 4) {
d.push((sp: sp, x: i, y: i))
}
}
#plot(
data: d,
mapping: aes(x: "x", y: "y"),
layers: (geom-point(size: 2pt),),
facet: facet-wrap("sp", labeller: label-both()),
width: 10cm,
height: 5cm,
)Override separator to use a different separator.
#let d = ()
#for sp in ("a", "b") {
for i in range(0, 4) {
d.push((sp: sp, x: i, y: i))
}
}
#plot(
data: d,
mapping: aes(x: "x", y: "y"),
layers: (geom-point(size: 2pt),),
facet: facet-wrap("sp", labeller: label-both(separator: " = ")),
width: 10cm,
height: 5cm,
)