scale-shape-manual
Manual discrete shape scale: supply the shape-keyword array directly.
Keywords cycle through values in the order levels appear, unless limits fixes the level order.
Usage
scale-shape-manual(
values: (),
name: none,
limits: none,
labels: auto,
)Parameters
| Parameter | Default | Description |
|---|---|---|
values |
() |
Array of shape 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
Custom three-shape cycle assigned in input order.
#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", shape: "sp"),
layers: (geom-point(size: 3pt),),
scales: (scale-shape-manual(
values: ("circle", "triangle", "diamond"),
),),
width: 10cm,
height: 6cm,
)limits pins the level order so the shape mapping stays stable across datasets.
#let d = (
(x: 1, y: 3, sp: "c"),
(x: 2, y: 4, sp: "a"),
(x: 3, y: 2, sp: "b"),
)
#plot(
data: d,
mapping: aes(x: "x", y: "y", shape: "sp"),
layers: (geom-point(size: 4pt),),
scales: (scale-shape-manual(
values: ("circle", "triangle", "diamond"),
limits: ("a", "b", "c"),
),),
width: 10cm,
height: 6cm,
)