Skip to content

Commit

Permalink
note gridGraphics requirement in example (#338)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelChirico committed Jan 4, 2024
1 parent 51a6eff commit fca5e30
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions R/wrap_elements.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@
#' p1 <- ggplot(mtcars) + geom_point(aes(mpg, disp))
#' p1 + wrap_elements(panel = p1 + ggtitle('Look at me shrink'))
#'
#' # You can even add base graphics if you pass it as a formula
#' p1 + wrap_elements(full = ~ plot(mtcars$mpg, mtcars$disp))
#' # 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)
#' # Adding a grob or formula directly is equivalent to placing it in `full`
#' p1 + ~ plot(mtcars$mpg, mtcars$disp)
#' }
#'
wrap_elements <- function(panel = NULL, plot = NULL, full = NULL, clip = TRUE, ignore_tag = FALSE) {
clip <- if (clip) 'on' else 'off'
Expand Down
10 changes: 6 additions & 4 deletions man/wrap_elements.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fca5e30

Please sign in to comment.