From 30fbc11f1673f8849a6a7577b3376d827a838b53 Mon Sep 17 00:00:00 2001 From: Carson Date: Tue, 17 Aug 2021 12:24:53 -0500 Subject: [PATCH] Can't assume we have cairo capabilities in examples --- R/images.R | 13 +++++++------ man/plotTag.Rd | 13 +++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/R/images.R b/R/images.R index 86017bc1..3f36d107 100644 --- a/R/images.R +++ b/R/images.R @@ -138,12 +138,13 @@ capturePlot <- function(expr, filename = tempfile(fileext = ".png"), #' #' if (interactive()) img #' -#' -#' svg <- plotTag(plot(pressure), "A plot of the 'pressure' dataset", -#' device = grDevices::svg, width = 375, height = 275, pixelratio = 1/72, -#' mimeType = "image/svg+xml") -#' -#' if (interactive()) svg +#' if (interactive() && capabilities("cairo")) { +#' plotTag( +#' plot(pressure), "A plot of the 'pressure' dataset", +#' device = grDevices::svg, width = 375, height = 275, pixelratio = 1/72, +#' mimeType = "image/svg+xml" +#' ) +#' } #' #' @export plotTag <- function(expr, alt, device = defaultPngDevice(), width = 400, height = 400, diff --git a/man/plotTag.Rd b/man/plotTag.Rd index 37a1b137..da332789 100644 --- a/man/plotTag.Rd +++ b/man/plotTag.Rd @@ -67,12 +67,13 @@ img <- plotTag({ if (interactive()) img - -svg <- plotTag(plot(pressure), "A plot of the 'pressure' dataset", - device = grDevices::svg, width = 375, height = 275, pixelratio = 1/72, - mimeType = "image/svg+xml") - -if (interactive()) svg +if (interactive() && capabilities("cairo")) { + plotTag( + plot(pressure), "A plot of the 'pressure' dataset", + device = grDevices::svg, width = 375, height = 275, pixelratio = 1/72, + mimeType = "image/svg+xml" + ) +} } \seealso{