Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace confusing wording for themes in vignette #6075

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading