Skip to content

Superfluous guidance in "Creating a new theme" section of ggplot2 packages vignette? #5927

Closed
@david-romano

Description

@david-romano

[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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions