Palettes and scales for professional statistical graphics

forma_palette.RdThe light colour scales use Okabe-Ito, the Viridis HCL approximation and Blue-Red 3. In dark mode the black category changes to light grey. The sequential palette uses the brighter section of Viridis, and the diverging palette uses Blue-Red 2. Set the same mode on the theme and scale. Use fixed scale limits with original category IDs to keep a cross-plot key. A label change then retains the category's position and colour.
Usage
forma_palette(
n,
type = c("discrete", "sequential", "diverging"),
reverse = FALSE,
mode = c("light", "dark"),
medium = c("colour", "greyscale")
)
scale_colour_forma(
type = c("discrete", "sequential", "diverging"),
...,
reverse = FALSE,
midpoint = 0,
mode = c("light", "dark"),
medium = c("colour", "greyscale")
)
scale_fill_forma(
type = c("discrete", "sequential", "diverging"),
...,
reverse = FALSE,
midpoint = 0,
mode = c("light", "dark"),
medium = c("colour", "greyscale")
)Arguments
- n
Number of colours. Discrete values may not exceed palette capacity.
- type
Discrete, sequential or diverging.
- reverse
Reverse palette order.
- mode
Intended light or dark background.
- medium
Colour output or greyscale reproduction.
- ...
Arguments to the corresponding ggplot2 scale.
- midpoint
Value at the neutral colour of a diverging scale.
Details
The five-category greyscale uses alternating lightness. Ordered print
scales encode magnitude with lightness. On a signed greyscale the labelled
midpoint separates the two signs. A legend, text or line pattern can help
distinguish values when colours or shades appear similar. Mosaic residual
shading and its model-specific breaks are configured with ggmosaic().

