Skip to content

Commit

Permalink
replace confusing wording
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand committed Sep 4, 2024
1 parent 57ba97f commit af7147e
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions vignettes/ggplot2-in-packages.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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 packagemay 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()
}
```

Expand Down

0 comments on commit af7147e

Please sign in to comment.