scale-colour-identity

Colour scale that uses each row’s value as the stroke colour directly.

The mapped column must hold values acceptable to Typst’s rgb() (e.g., "#ff0000") or already be color values. No legend is drawn because the column carries the visual outcome verbatim.

Usage

scale-colour-identity(
  ..args,
)

Parameters

Parameter Default Description
..args

Returns

Scale object consumed by plot.

Examples

Hex strings carried straight through to point strokes; no legend is drawn.

#let d = (
  (x: 1, y: 2, c: "#1b9e77"),
  (x: 2, y: 4, c: "#d95f02"),
  (x: 3, y: 3, c: "#7570b3"),
)
#plot(
  data: d,
  mapping: aes(x: "x", y: "y", colour: "c"),
  layers: (geom-point(size: 3pt),),
  scales: (scale-colour-identity(),),
  width: 10cm,
  height: 6cm,
)

Scatter chart of three points where the c column passes through hex strings verbatim, drawing teal, orange, and blue strokes with no legend.

Scatter chart of three points where the c column passes through hex strings verbatim, drawing teal, orange, and blue strokes with no legend.

See also

scale-colour-manual, scale-fill-identity.

Back to top