scale-linetype-manual
Manual discrete linetype scale: supply the dash-keyword array directly.
Keywords cycle through values following the alphabetical level order, unless limits fixes a different order.
Usage
scale-linetype-manual(
values: (),
name: none,
limits: none,
oob: "drop",
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. |
oob |
"drop" |
Out-of-range policy: "drop" (default) removes rows whose value falls outside limits; "squish" clamps continuous values to the nearest endpoint. |
labels |
auto |
Array of legend labels aligned with limits, or auto. |
Returns
Scale object consumed by plot.
Examples
Two-keyword cycle following the default alphabetical order: group a takes solid, group b takes dashed.
#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 reorders the levels: listing b first makes group b take solid and group a take dashed, reversing the default.
#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"),
limits: ("b", "a"),
),),
width: 10cm,
height: 6cm,
)