ggplot theme with larger font sizes

A common question I get from collaborators and other R users is if there's a way to just increase the font size for all text. I assume the easiest is to define the base_size argument in the ggthemes? Or is there a way to pre-set this as some kind of options at the start of the script?

The easiest way I know of is to set the base_size in a theme call. This is done within the ggplot, so no additional dependency is needed.

But it has to be done for each plot individually, there is no global option that I know of.

library(tidyverse)

ggplot(mtcars, aes(wt, mpg)) +
   geom_point() +
   labs(title = "Fuel economy declines as weight increases") +
   theme_classic(base_size = 25) # big, big text

You can set theme options globally for each session with theme_set()

library(ggplot2)

theme_set(
    theme_classic(base_size = 25)
)


ggplot(mtcars, aes(wt, mpg)) +
    geom_point() +
    labs(title = "Fuel economy declines as weight increases")

2 Likes

thank you @andresrcs for pointing this out - this is a super useful setting, once you think about it...

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.