Skip to contents

Start with one theme and choose a preset for the physical output. Report preserves the original 12 pt layout. Journal defaults to 10 pt with thinner rules, editorial to 13 pt with a stronger title hierarchy, presentation to 18 pt, and dashboard to 10 pt with compact framed panels.

library(ggplot2)
library(ggforma)
cars <- transform(mtcars, cylinders = factor(cyl))
p <- ggplot(cars, aes(wt, mpg, colour = cylinders, shape = cylinders)) +
  geom_point(size = 2.5) + labs(x = "Weight (1,000 lb)", y = "Miles per gallon")
p + scale_colour_forma() + theme_forma(preset = "report")

p + scale_colour_forma(mode = "dark") +
  theme_forma(preset = "presentation", mode = "dark")

Use a documented order for discrete IDs. Set the same limits on plots that should share colours while showing different subsets. Map shape or linetype as a second cue. The light print palette has five category shades. The light colour palette has nine entries including a yellow that has low contrast against white.

p + scale_colour_forma(limits = levels(cars$cylinders), medium = "greyscale") +
  facet_wrap(vars(am)) + theme_forma(preset = "journal", panel = "framed")

forma_palette(5, type = "sequential")
[1] "#4B0055" "#00588B" "#009B95" "#53CC67" "#FDE333"
forma_palette(5, type = "diverging")
[1] "#002F70" "#879FDB" "#F6F6F6" "#DA8A8B" "#5F1415"

Choose a sequential scale for measurements with a natural order and a diverging scale for deviations around a meaningful centre. scale_fill_forma("diverging", midpoint = 0) maps the centre explicitly. Model-specific Mosaic residual shading also defines signed breaks and a legend. Set that shading at construction. A complete theme replaces the chart’s plot-specific settings. Use ggplot2’s theme() for a small adjustment to a finished Pie or Mosaic.