From e61831747e43f991f95c7b6ac04c0ee7f25e4bc4 Mon Sep 17 00:00:00 2001 From: Thomas Lin Pedersen Date: Wed, 17 Nov 2021 13:31:39 +0100 Subject: [PATCH] Remove filename from the call to custom devices if file is present in the formals --- NEWS.md | 3 +++ R/save.r | 1 + 2 files changed, 4 insertions(+) diff --git a/NEWS.md b/NEWS.md index 9a8a8fc713..354fc053f5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ # ggplot2 (development version) +* Better compatibility of custom device functions in `ggsave()` + (@thomasp85, #4539) + * Strip padding in `facet_grid()` is now only in effect if `strip.placement = "outside"` _and_ an axis is present between the strip and the panel (@thomasp85, #4610) diff --git a/R/save.r b/R/save.r index 8238f893c6..0a5738f22f 100644 --- a/R/save.r +++ b/R/save.r @@ -162,6 +162,7 @@ plot_dev <- function(device, filename = NULL, dpi = 300) { call_args <- list() if ("file" %in% names(args)) { call_args$file <- filename + call_args["filename"] <- list(NULL) } if ("res" %in% names(args)) { call_args$res <- dpi