scale-colour-continuous

Continuous colour scale mapping a numeric column to stroke colours.

Usage

scale-colour-continuous(
  ..args,
)

Parameters

Parameter Default Description
..args

Returns

Scale object consumed by plot.

Examples

Default ramp interpolating between the library’s low and high blue stops.

#let d = range(0, 12).map(i => (x: i, y: i, z: i * 0.5))
#plot(
  data: d,
  mapping: aes(x: "x", y: "y", colour: "z"),
  layers: (geom-point(size: 3pt),),
  scales: (scale-colour-continuous(),),
  width: 10cm,
  height: 6cm,
)

Scatter chart of twelve diagonal points coloured by z along a continuous blue ramp from dark navy at low values to light sky-blue at high values.

Scatter chart of twelve diagonal points coloured by z along a continuous blue ramp from dark navy at low values to light sky-blue at high values.

Pin limits to clip the trained domain and render extremes at the palette endpoints.

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

Scatter chart of twelve diagonal points coloured by z along the continuous blue ramp, with limits 1 through 4 clamping out-of-range values to palette endpoints.

Scatter chart of twelve diagonal points coloured by z along the continuous blue ramp, with limits 1 through 4 clamping out-of-range values to palette endpoints.

See also

scale-colour-viridis-c, scale-colour-discrete, scale-fill-continuous.

Back to top