Closed
Description
[Motivated by Posit Forum post Creating a new ggplot2 theme.]
The Creating a new theme section of the vignette on using ggplot2 in packages creates a new theme called theme_custom()
and advises using a wrapper to apply the new theme:
default_theme <- function() {
theme_custom()
}
mpg_drv_summary2 <- function() {
mpg_drv_summary() + default_theme()
}
However, since theme_custom()
is already a function, the reason for the wrapper in not clear. The motivation given is that:
[...i]f not, the theme object is stored in the compiled bytecode of the built package, which may or may not align with the installed version of ggplot2!
but my understanding is that this shouldn't happen unless, say, the package contained a call to theme_set()
.
Is the wrapper superfluous, or am I missing something?