scale-continuous

Continuous scale for any continuous aesthetic.

Keyed to x/y it controls the axis (limits, breaks, transform, expand, secondary); keyed to colour/fill it sets the palette; keyed to size/alpha/linewidth/stroke it sets the output range.

Usage

scale-continuous(
  ..args,
)

Parameters

Parameter Default Description
..args Named arguments forwarded to the bound scale (e.g. name, limits, breaks, labels, and aesthetic-specific keys such as transform or range).

Returns

Deferred scale spec consumed by scales.

Examples

Pin the x domain and rename the axis with a continuous scale.

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

Scatter chart of ten squared values with the x axis renamed to Index and pinned to the range 0 through 12.

Scatter chart of ten squared values with the x axis renamed to Index and pinned to the range 0 through 12.

See also

scales, scale-discrete, scale-binned.

Back to top