ggplot2::theme_set()
get_help()
docs
The theme_set()
function is part of the {ggplot2}
package, which is part of the {tidyverse}
.
We use the theme_set()
function to specify a default theme for {ggplot2}
plots.
To use this function, you need to either first load the {ggplot2}
library, or always use the function with ggplot2::theme_set()
notation.
# Load the library
library(ggplot2)
# Or, load the full tidyverse:
library(tidyverse)
# Or, use :: notation
::theme_set() ggplot2
# Set the default theme to the complete theme theme_bw(), for example
theme_set(theme_bw())
# Set the default theme to the complete theme theme_bw(), with some additional customization
# of increasing the axis text size to be 1.5-times the default theme_bw() axis text size
theme_set(theme_bw() +
theme(axis.text = element_text(size = rel(1.5))))