stat-sum
Sum statistic: one output row per unique (x, y) pair with _n and _prop.
Output rows preserve first-seen pair order. The stat re-maps size to the "_n" column so geoms picking up the aesthetic see counts directly.
Usage
stat-sum()Returns
Statistic object with name: "sum", consumed by geom layers.
Outputs
x.y._n._prop.
Examples
Marker size grows with the count of duplicate (x, y) rows.
#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-count(),),
width: 10cm,
height: 6cm,
)Constructor form: stat: stat-sum() is equivalent to stat: "sum" with defaults.
#let d = (
(x: 1, y: 1), (x: 1, y: 1), (x: 1, y: 1),
(x: 2, y: 2),
(x: 3, y: 3), (x: 3, y: 3),
)
#plot(
data: d,
mapping: aes(x: "x", y: "y"),
layers: (geom-point(stat: stat-sum(), size: 3pt),),
scales: (scale-size-area(range: (2pt, 14pt)),),
width: 10cm,
height: 6cm,
)