scale-colour-viridis-d

Discrete viridis colour scale.

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

Usage

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

Parameters

Parameter Default Description
..args

Returns

Scale object consumed by plot.

Examples

Plasma option of the viridis family applied to four categories.

#let d = (
  (x: 1, y: 2, sp: "a"),
  (x: 2, y: 4, sp: "b"),
  (x: 3, y: 3, sp: "c"),
  (x: 4, y: 5, sp: "d"),
)
#plot(
  data: d,
  mapping: aes(x: "x", y: "y", colour: "sp"),
  layers: (geom-point(size: 3pt),),
  scales: (scale-colour-viridis-d(option: "plasma"),),
  width: 10cm,
  height: 6cm,
)

Scatter chart of four points where sp maps to distinct categorical colours sampled from the plasma viridis palette ranging from purple to yellow.

Scatter chart of four points where sp maps to distinct categorical colours sampled from the plasma viridis palette ranging from purple to yellow.

Switching option to "cividis" selects the colour-blind safe alternative.

#let d = (
  (x: 1, y: 2, sp: "a"),
  (x: 2, y: 4, sp: "b"),
  (x: 3, y: 3, sp: "c"),
  (x: 4, y: 5, sp: "d"),
)
#plot(
  data: d,
  mapping: aes(x: "x", y: "y", colour: "sp"),
  layers: (geom-point(size: 3pt),),
  scales: (scale-colour-viridis-d(option: "cividis"),),
  width: 10cm,
  height: 6cm,
)

Scatter chart of four points where sp maps to colours sampled from the colour-blind safe cividis palette running from dark blue to bright yellow.

Scatter chart of four points where sp maps to colours sampled from the colour-blind safe cividis palette running from dark blue to bright yellow.

See also

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

Back to top