scale-size-continuous

Continuous size scale mapping a numeric column to a size range.

Usage

scale-size-continuous(
  name: none,
  range: (1pt, 6pt),
  limits: none,
  breaks: auto,
  labels: auto,
)

Parameters

Parameter Default Description
name none Legend title. Overrides any name set via labs when both are present.
range (1pt, 6pt) Pair of Typst lengths (min, max) bounding the output size.
limits none Pair (lo, hi) clipping the trained domain, or none.
breaks auto Array of break values for the legend, or auto.
labels auto Array of legend labels aligned with breaks, or auto.

Returns

Scale object consumed by plot.

Examples

Linear size mapping with the default 1pt-to-6pt range.

#let d = range(0, 10).map(i => (x: i, y: i, w: i + 1))
#plot(
  data: d,
  mapping: aes(x: "x", y: "y", size: "w"),
  layers: (geom-point(),),
  scales: (scale-size-continuous(range: (1pt, 6pt)),),
  width: 10cm,
  height: 6cm,
)

Scatter chart of ten diagonal points where marker radius scales linearly with w from a small to a moderate dot.

Scatter chart of ten diagonal points where marker radius scales linearly with w from a small to a moderate dot.

Widen the range for stronger visual contrast on small numeric differences.

#let d = range(0, 10).map(i => (x: i, y: i, w: i + 1))
#plot(
  data: d,
  mapping: aes(x: "x", y: "y", size: "w"),
  layers: (geom-point(),),
  scales: (scale-size-continuous(range: (2pt, 14pt)),),
  width: 10cm,
  height: 6cm,
)

Scatter chart of ten diagonal points where the widened 2pt to 14pt range exaggerates marker-radius contrast across w.

Scatter chart of ten diagonal points where the widened 2pt to 14pt range exaggerates marker-radius contrast across w.

See also

scale-shape, scale-colour-continuous.

Back to top