scale-linewidth-identity

Linewidth scale that uses each row’s value as the stroke thickness.

Values must be Typst lengths. No legend is drawn because the column carries the visual outcome verbatim.

Usage

scale-linewidth-identity(
  name: none,
)

Parameters

Parameter Default Description
name none Legend title. Identity scales draw no legend.

Returns

Scale object consumed by plot.

Examples

Per-row Typst lengths carried straight through to the line strokes; no legend is drawn.

#let d = (
  (x: 1, y: 2, g: "a", lw: 0.4pt),
  (x: 2, y: 3, g: "a", lw: 0.4pt),
  (x: 1, y: 1, g: "b", lw: 1.2pt),
  (x: 2, y: 2, g: "b", lw: 1.2pt),
)
#plot(
  data: d,
  mapping: aes(x: "x", y: "y", group: "g", linewidth: "lw"),
  layers: (geom-line(),),
  scales: (scale-linewidth-identity(),),
  width: 10cm,
  height: 6cm,
)

Line chart of two segments along x against y where the lw column passes through as the stroke thickness, one thin and one thick, with no legend.

Line chart of two segments along x against y where the lw column passes through as the stroke thickness, one thin and one thick, with no legend.

See also

scale-linewidth-continuous.

Back to top