scale-fill-viridis-d

Discrete viridis fill scale.

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

Usage

scale-fill-viridis-d(
  ..args,
)

Parameters

Parameter Default Description
..args

Returns

Scale object consumed by plot.

Examples

Cividis option filling four categorical bars.

#let d = (
  (grp: "a", y: 1),
  (grp: "b", y: 2),
  (grp: "c", y: 3),
  (grp: "d", y: 4),
)
#plot(
  data: d,
  mapping: aes(x: "grp", y: "y", fill: "grp"),
  layers: (geom-col(),),
  scales: (scale-fill-viridis-d(option: "cividis"),),
  width: 10cm,
  height: 6cm,
)

Bar chart of four bars a, b, c, d filled with distinct colours sampled from the colour-blind safe cividis palette ranging dark blue to yellow.

Bar chart of four bars a, b, c, d filled with distinct colours sampled from the colour-blind safe cividis palette ranging dark blue to yellow.

Each viridis option laid out as a swatch strip via geom-rect.

#let opts = ("viridis", "magma", "plasma", "inferno", "cividis")
#let d = opts.enumerate().map(((i, k)) => (
  xmin: i, xmax: i + 1, ymin: 0, ymax: 1, k: k,
))
#plot(
  data: d,
  mapping: aes(xmin: "xmin", xmax: "xmax", ymin: "ymin", ymax: "ymax", fill: "k"),
  layers: (geom-rect(),),
  scales: (scale-fill-viridis-d(option: "magma"),),
  guides: guides(fill: guide-none()),
  width: 6cm,
  height: 1cm,
)

Legend swatch strip of five rectangles filled with distinct colours sampled from the magma viridis palette spanning black through red to pale cream.

Legend swatch strip of five rectangles filled with distinct colours sampled from the magma viridis palette spanning black through red to pale cream.

See also

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

Back to top