stage

Compose all three late-binding lanes for a single aesthetic.

start (column name) names the column used during initial scale training, before the stat runs. after-stat (string column name or (row, ctx) => any) takes effect after the stat. after-scale ((value, ctx) => any) post-transforms the channel’s resolved scale value just before draw. Any lane may be none.

Usage

stage(
  start: none,
  after-stat: none,
  after-scale: none,
)

Parameters

Parameter Default Description
start none Column name used for initial training, or none.
after-stat none Post-stat expression, or none.
after-scale none Post-scale closure, or none.

Returns

Late-binding marker consumed by aes.

Examples

Train the outline colour on the same column as fill, then darken the resolved swatch per row.

#let d = (
  (x: 1, y: 2, sp: "a"),
  (x: 2, y: 4, sp: "b"),
  (x: 3, y: 3, sp: "c"),
  (x: 4, y: 5, sp: "a"),
)
#plot(
  data: d,
  mapping: aes(
    x: "x", y: "y", fill: "sp",
    colour: stage(start: "sp", after-scale: (c, _) => c.darken(40%)),
  ),
  layers: (geom-point(size: 5pt, stroke: 0.8pt),),
  width: 10cm,
  height: 6cm,
)

Scatter chart of four points whose outline trains on the fill column and darkens the resolved swatch via stage.

Scatter chart of four points whose outline trains on the fill column and darkens the resolved swatch via stage.

See also

after-stat, after-scale, aes.

Back to top