From af7147e6c492e06a67786a7b58674a965188cc36 Mon Sep 17 00:00:00 2001 From: Teun van den Brand Date: Wed, 4 Sep 2024 13:22:53 +0200 Subject: [PATCH] replace confusing wording --- vignettes/ggplot2-in-packages.Rmd | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/vignettes/ggplot2-in-packages.Rmd b/vignettes/ggplot2-in-packages.Rmd index 691dac0298..c6a4ab4013 100644 --- a/vignettes/ggplot2-in-packages.Rmd +++ b/vignettes/ggplot2-in-packages.Rmd @@ -190,15 +190,11 @@ theme_custom <- function(...) { mpg_drv_summary() + theme_custom() ``` -It is important that the theme be calculated after the package is loaded. If 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! If your package has a default theme for its visualizations, the correct way to load it is to have a function that returns the default theme: +It is important that the theme be calculated after the package is loaded. If not, a theme object —stored as a variable in the built package— may or may not align with the installed version of ggplot2! If your package has a default theme for its visualizations, the correct way to apply this theme is by calling the constructor: ```{r} -default_theme <- function() { - theme_custom() -} - mpg_drv_summary2 <- function() { - mpg_drv_summary() + default_theme() + mpg_drv_summary() + theme_custom() } ```