scale-area

Area-proportional continuous size scale.

Marker area, rather than diameter, scales linearly with the value.

Usage

scale-area(
  ..args,
)

Parameters

Parameter Default Description
..args Named arguments forwarded to the size scale (e.g. range, name, limits, breaks, labels).

Returns

Deferred scale spec consumed by scales.

Examples

Scale marker area, not diameter, with the value.

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

Scatter chart of seven diagonal points where marker area grows with the square root of a quadratic column so visual area tracks the value.

Scatter chart of seven diagonal points where marker area grows with the square root of a quadratic column so visual area tracks the value.

See also

scales, scale-continuous, scale-radius.

Back to top