stat-connect
Connection statistic: expand consecutive points with intermediate vertices.
Modes:
"hv"(default): horizontal then vertical. Inserts(x_{i+1}, y_i)between each pair."vh": vertical then horizontal. Inserts(x_i, y_{i+1})."mid": half-step both ways. Inserts(mid, y_i)and(mid, y_{i+1})at the midpoint."linear": pass-through (no intermediate vertices).
Usage
stat-connect(
connection: "hv",
)Parameters
| Parameter | Default | Description |
|---|---|---|
connection |
"hv" |
Connection mode ("hv" / "vh" / "mid" / "linear"). |
Returns
Statistic object with name: "connect", consumed by geom layers.
Outputs
x.y.
Examples
Step-style line via "mid": midpoint corners between consecutive observations.
#let d = range(0, 7).map(i => (x: i, y: calc.rem(i * 3, 5)))
#plot(
data: d,
mapping: aes(x: "x", y: "y"),
layers: (geom-path(stat: stat-connect(connection: "mid"), stroke: 1pt),),
width: 10cm,
height: 6cm,
)