stat-connect

Connection statistic: expand consecutive points with intermediate vertices.

Modes:

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,
)

Step line chart with x and y axes, connecting points through midpoint corners so the path turns halfway between consecutive observations.

Step line chart with x and y axes, connecting points through midpoint corners so the path turns halfway between consecutive observations.

See also

geom-step, geom-path.

Back to top