scale-linetype-manual
Manual discrete linetype scale: supply the dash-keyword array directly.
Keywords cycle through values in the order levels appear, unless limits fixes the level order.
Usage
scale-linetype-manual(
values: (),
name: none,
limits: none,
labels: auto,
)Parameters
| Parameter | Default | Description |
|---|---|---|
values |
() |
Array of dash keywords, one per level. |
name |
none |
Legend title. Overrides any name set via labs when both are present. |
limits |
none |
Array of level names controlling order and inclusion, or none. |
labels |
auto |
Array of legend labels aligned with limits, or auto. |
Returns
Scale object consumed by plot.
Examples
Two-keyword cycle assigned in input order.
#let d = (
(x: 1, y: 2, grp: "a"),
(x: 2, y: 4, grp: "a"),
(x: 1, y: 1, grp: "b"),
(x: 2, y: 2, grp: "b"),
)
#plot(
data: d,
mapping: aes(x: "x", y: "y", linetype: "grp"),
layers: (geom-line(stroke: 1pt),),
scales: (scale-linetype-manual(values: ("solid", "dashed")),),
width: 10cm,
height: 6cm,
)limits fixes the level order so the same dash maps to the same group regardless of input order.
#let d = (
(x: 1, y: 1, grp: "b"), (x: 2, y: 2, grp: "b"),
(x: 1, y: 2, grp: "a"), (x: 2, y: 4, grp: "a"),
)
#plot(
data: d,
mapping: aes(x: "x", y: "y", linetype: "grp"),
layers: (geom-line(stroke: 1pt),),
scales: (scale-linetype-manual(
values: ("solid", "dashed"),
limits: ("a", "b"),
),),
width: 10cm,
height: 6cm,
)