stat-identity
Identity statistic: returns data and mapping unchanged.
Useful as an explicit marker; most geoms default to this statistic.
Usage
stat-identity()Returns
Statistic object with name: "identity", consumed by geom layers.
Outputs
This stat passes input rows through unchanged.
Examples
Explicit stat: "identity" on a scatter, equivalent to the default behaviour.
#let d = (
(x: 1, y: 2),
(x: 2, y: 4),
(x: 3, y: 3),
)
#plot(
data: d,
mapping: aes(x: "x", y: "y"),
layers: (geom-point(size: 3pt, stat: "identity"),),
width: 10cm,
height: 6cm,
)Pre-aggregated heights drawn directly with geom-col, using stat-identity to skip any binning.
#let d = (
(q: "Q1", revenue: 10),
(q: "Q2", revenue: 18),
(q: "Q3", revenue: 25),
(q: "Q4", revenue: 22),
)
#plot(
data: d,
mapping: aes(x: "q", y: "revenue"),
layers: (geom-col(stat: stat-identity()),),
width: 10cm,
height: 6cm,
)