scale-colour-viridis-c

Continuous viridis colour scale.

option selects between "viridis", "magma", "plasma", "inferno", and "cividis".

Usage

scale-colour-viridis-c(
  option,
  name,
  limits,
  oob,
  breaks,
  labels,
)

Parameters

Parameter Default Description
option Palette name: "viridis", "magma", "plasma", "inferno", or "cividis".
name Legend title. Overrides any name set via labels when both are present.
limits Pair (lo, hi) clipping the trained domain, or none.
oob Out-of-range policy: "drop" (default) removes rows whose value falls outside limits; "squish" clamps continuous values to the nearest endpoint.
breaks Array of break values for the legend, or auto.
labels Array of legend labels aligned with breaks, or auto.

Returns

Scale object consumed by plot.

Examples

Magma option applied to a continuous numeric column.

#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-viridis-c(option: "magma"),),
  width: 10cm,
  height: 6cm,
)

Scatter chart of twelve diagonal points coloured by z along a continuous magma ramp from black at low values through purple-red to pale yellow at high.

Scatter chart of twelve diagonal points coloured by z along a continuous magma ramp from black at low values through purple-red to pale yellow at high.

Default "viridis" ramp with limits clipping the lower tail.

#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-viridis-c(limits: (2, 6)),),
  width: 10cm,
  height: 6cm,
)

Scatter chart of twelve diagonal points coloured along the viridis ramp from purple to yellow, with limits 2 through 6 clamping the lower tail to the dark end.

Scatter chart of twelve diagonal points coloured along the viridis ramp from purple to yellow, with limits 2 through 6 clamping the lower tail to the dark end.

See also

scale-colour-viridis-d, scale-colour-viridis-b, scale-fill-viridis-c.

Back to top