scale-fill-viridis-c

Continuous viridis fill scale.

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

Usage

scale-fill-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 labs 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

Default viridis ramp filling bars by their numeric value.

#let d = range(0, 12).map(i => (grp: str(i), y: i + 1))
#plot(
  data: d,
  mapping: aes(x: "grp", y: "y", fill: "y"),
  layers: (geom-col(),),
  scales: (scale-fill-viridis-c(option: "viridis"),),
  width: 10cm,
  height: 6cm,
)

Bar chart of twelve increasing bars filled along the continuous viridis ramp from dark purple at low y to bright yellow at high y.

Bar chart of twelve increasing bars filled along the continuous viridis ramp from dark purple at low y to bright yellow at high y.

The viridis ramp shown as a continuous swatch via geom-rect.

#let d = range(0, 16).map(i => (
  xmin: i, xmax: i + 1, ymin: 0, ymax: 1, z: i,
))
#plot(
  data: d,
  mapping: aes(xmin: "xmin", xmax: "xmax", ymin: "ymin", ymax: "ymax", fill: "z"),
  layers: (geom-rect(),),
  scales: (scale-fill-viridis-c(),),
  guides: guides(fill: none),
  theme: theme-void(),
  width: 10cm,
  height: 1cm,
)

Colour-bar swatch of sixteen rectangles displaying the continuous viridis fill ramp from dark purple on the left to bright yellow on the right.

Colour-bar swatch of sixteen rectangles displaying the continuous viridis fill ramp from dark purple on the left to bright yellow on the right.

See also

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

Back to top