tidyverse / ggplot2

An implementation of the Grammar of Graphics in R
https://ggplot2.tidyverse.org
Other
6.48k stars 2.02k forks source link

Have header font be part of theme specification #5886

Closed thomasp85 closed 2 months ago

thomasp85 commented 4 months ago

Currently the theme constructors takes a base font argument to set the font for the titles/headers.

This ties into #5833 as we should also keep at least two fonts in the geom defaults inside themes

teunbrand commented 4 months ago

Is the proposal here to do something like the following?

theme_grey <- function(..., base_family = "", header_family = base_family) {
  theme(
    text = element_text(family = base_family),
    title = element_text(family = header_family),
    ...
  )
}
thomasp85 commented 4 months ago

Yes, exactly. I think subtitle and caption should inherit from the base font and title, axis title and guide title should inherit from the header font