stat-unique
Unique statistic: keep the first row per (x, y) key, drop later duplicates.
The dedup key concatenates the values referenced by mapping.x and mapping.y. Mapping is returned unchanged.
Usage
stat-unique()Returns
Statistic object with name: "unique", consumed by geom layers.
Outputs
This stat passes input rows through unchanged.
Examples
Drop the duplicate (1, 1) row; the rendered scatter shows each pair only once.
#let d = (
(x: 1, y: 1),
(x: 1, y: 1),
(x: 2, y: 2),
)
#plot(
data: d,
mapping: aes(x: "x", y: "y"),
layers: (geom-point(stat: "unique"),),
width: 10cm,
height: 6cm,
)Constructor form: stat: stat-unique() is equivalent to stat: "unique" with defaults.
#let d = (
(x: 1, y: 1),
(x: 1, y: 1),
(x: 2, y: 2),
)
#plot(
data: d,
mapping: aes(x: "x", y: "y"),
layers: (geom-point(stat: stat-unique(), size: 3pt),),
width: 10cm,
height: 6cm,
)