Skip to content

Commit 93882e6

Browse files
committed
ggsave(): fix partial argument match
1 parent e1ad189 commit 93882e6

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ up correct aspect ratio, and draws a graticule.
253253
* `ggsave()`'s DPI argument now supports 3 string options: "retina" (320
254254
DPI), "print" (300 DPI), and "screen" (72 DPI) (@foo-bar-baz-qux, #2156).
255255

256+
* Fixed partial argument matches in `ggsave()`. (#2355)
257+
256258
* `ggsave()` now correctly restores the previous graphics device when several
257259
graphics devices are open. (#2363)
258260

R/save.r

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ ggsave <- function(filename, plot = last_plot(),
5454
filename <- file.path(path, filename)
5555
}
5656
old_dev <- dev.cur()
57-
dev(file = filename, width = dim[1], height = dim[2], ...)
57+
dev(filename = filename, width = dim[1], height = dim[2], ...)
5858
on.exit(utils::capture.output({
5959
grDevices::dev.off()
6060
dev.set(old_dev)
@@ -120,16 +120,16 @@ plot_dev <- function(device, filename, dpi = 300) {
120120
if (is.function(device))
121121
return(device)
122122

123-
eps <- function(...) {
124-
grDevices::postscript(..., onefile = FALSE, horizontal = FALSE,
123+
eps <- function(filename, ...) {
124+
grDevices::postscript(file = filename, ..., onefile = FALSE, horizontal = FALSE,
125125
paper = "special")
126126
}
127127
devices <- list(
128128
eps = eps,
129129
ps = eps,
130-
tex = function(...) grDevices::pictex(...),
131-
pdf = function(..., version = "1.4") grDevices::pdf(..., version = version),
132-
svg = function(...) svglite::svglite(...),
130+
tex = function(filename, ...) grDevices::pictex(file = filename, ...),
131+
pdf = function(filename, ..., version = "1.4") grDevices::pdf(file = filename, ..., version = version),
132+
svg = function(filename, ...) svglite::svglite(file = filename, ...),
133133
emf = function(...) grDevices::win.metafile(...),
134134
wmf = function(...) grDevices::win.metafile(...),
135135
png = function(...) grDevices::png(..., res = dpi, units = "in"),

0 commit comments

Comments
 (0)