scale-colour-viridis-b

Binned viridis colour scale.

Partitions the continuous domain into n-breaks equal segments, each coloured from the chosen viridis palette.

Usage

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

Parameters

Parameter Default Description
..args

Returns

Scale object consumed by plot.

Examples

Four equal-width bins coloured from the default viridis ramp.

#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-b(n-breaks: 4),),
  width: 10cm,
  height: 6cm,
)

Scatter chart of twelve diagonal points where z is cut into four stepped bands coloured from the viridis ramp running purple to yellow.

Scatter chart of twelve diagonal points where z is cut into four stepped bands coloured from the viridis ramp running purple to yellow.

Bumping n-breaks and switching to the inferno option produces a finer-grained banded scale.

#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-b(option: "inferno", n-breaks: 8),),
  width: 10cm,
  height: 6cm,
)

Scatter chart of twelve diagonal points where z is cut into eight finer stepped bands coloured from the inferno ramp running black through red to bright yellow.

Scatter chart of twelve diagonal points where z is cut into eight finer stepped bands coloured from the inferno ramp running black through red to bright yellow.

See also

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

Back to top