| @@ -25,7 +25,8 @@ | |||
| #' @inheritDotParams theme_xaringan_base | |||
| #' | |||
| #' @examples | |||
| #' if (requireNamespace("ggplot2", quietly = TRUE)) { | |||
| #' has_ggplot2 <- requireNamespace("ggplot2", quietly = TRUE) | |||
| #' if (interactive() && has_ggplot2) { | |||
| #' # Set xaringanthemer theme but save to tempfile | |||
| #' style_duo_accent(outfile = tempfile()) | |||
| #' | |||
| @@ -83,7 +84,8 @@ theme_xaringan <- function( | |||
| #' @inheritDotParams theme_xaringan_base | |||
| #' | |||
| #' @examples | |||
| #' if (requireNamespace("ggplot2", quietly = TRUE)) { | |||
| #' has_ggplot2 <- requireNamespace("ggplot2", quietly = TRUE) | |||
| #' if (interactive() && has_ggplot2) { | |||
| #' # Set xaringanthemer theme but save to tempfile | |||
| #' style_duo_accent(outfile = tempfile()) | |||
| #' | |||
| @@ -164,7 +166,8 @@ theme_xaringan_inverse <- function( | |||
| #' @param ... Ignored | |||
| #' | |||
| #' @examples | |||
| #' if (requireNamespace("ggplot2", quietly = TRUE)) { | |||
| #' has_ggplot2 <- requireNamespace("ggplot2", quietly = TRUE) | |||
| #' if (interactive() && has_ggplot2) { | |||
| #' library(ggplot2) | |||
| #' ggplot(iris) + | |||
| #' aes(Petal.Length, Petal.Width) + | |||
| @@ -63,7 +63,8 @@ Creates \pkg{ggplot2} themes to match the xaringanthemer theme used in the | |||
| styles. | |||
| } | |||
| \examples{ | |||
| if (requireNamespace("ggplot2", quietly = TRUE)) { | |||
| has_ggplot2 <- requireNamespace("ggplot2", quietly = TRUE) | |||
| if (interactive() && has_ggplot2) { | |||
| # Set xaringanthemer theme but save to tempfile | |||
| style_duo_accent(outfile = tempfile()) | |||
| @@ -72,7 +72,8 @@ color). Also accepts an \code{accent_color} and an \code{accent_secondary_color} | |||
| xaringanthemer for a plot theme that matches the slide style. | |||
| } | |||
| \examples{ | |||
| if (requireNamespace("ggplot2", quietly = TRUE)) { | |||
| has_ggplot2 <- requireNamespace("ggplot2", quietly = TRUE) | |||
| if (interactive() && has_ggplot2) { | |||
| library(ggplot2) | |||
| ggplot(iris) + | |||
| aes(Petal.Length, Petal.Width) + | |||
| @@ -62,7 +62,8 @@ A \pkg{ggplot2} xaringanthemer plot theme to seamlessly match the "inverse" | |||
| \pkg{xaringan} slide colors and styles as styled by \link{xaringanthemer}. | |||
| } | |||
| \examples{ | |||
| if (requireNamespace("ggplot2", quietly = TRUE)) { | |||
| has_ggplot2 <- requireNamespace("ggplot2", quietly = TRUE) | |||
| if (interactive() && has_ggplot2) { | |||
| # Set xaringanthemer theme but save to tempfile | |||
| style_duo_accent(outfile = tempfile()) | |||