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

Example requires 'gridGraphics' #327

Closed
MichaelChirico opened this issue Aug 23, 2023 · 1 comment · Fixed by #338
Closed

Example requires 'gridGraphics' #327

MichaelChirico opened this issue Aug 23, 2023 · 1 comment · Fixed by #338

Comments

@MichaelChirico
Copy link
Contributor

MichaelChirico commented Aug 23, 2023

# You can even add base graphics if you pass it as a formula
p1 + wrap_elements(full = ~ plot(mtcars$mpg, mtcars$disp))
# Adding a grob or formula directly is equivalent to placing it in `full`
p1 + ~ plot(mtcars$mpg, mtcars$disp)

This example fails if gridGraphics is missing. Should we wrap the whole example in @examplesIf gridGraphics? Or perhaps it's better to note the requirement more explicitly:

# You can even add base graphics if you pass it as a formula (requires gridGraphics package)
if (requireNamespace("gridGraphics", quietly = TRUE)) {
  p1 + wrap_elements(full = ~ plot(mtcars$mpg, mtcars$disp))

  # Adding a grob or formula directly is equivalent to placing it in `full`
  p1 + ~ plot(mtcars$mpg, mtcars$disp)
}
@thomasp85
Copy link
Owner

yeah, last suggestion is good - would you like to make a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants