scale-colour-grey

Discrete grey colour scale.

Generates n evenly-spaced luma colours from start (darker) to end (lighter), each in [0, 1] where 0 is black and 1 is white.

Usage

scale-colour-grey(
  ..args,
)

Parameters

Parameter Default Description
..args

Returns

Scale object consumed by plot.

Examples

Default grey ramp from dark to light spread across three levels.

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

Scatter chart of three points where sp maps to three evenly-spaced grey luma values stepping from dark grey to light grey.

Scatter chart of three points where sp maps to three evenly-spaced grey luma values stepping from dark grey to light grey.

Narrowing start and end constrains the ramp to a darker range for tighter contrast.

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

Scatter chart of three points where sp maps to a narrowed grey ramp from luma 0.1 to 0.5, keeping the palette in the darker half of the scale.

Scatter chart of three points where sp maps to a narrowed grey ramp from luma 0.1 to 0.5, keeping the palette in the darker half of the scale.

See also

scale-fill-grey, scale-colour-discrete.

Back to top