Skip to content

Commit 4bb1e44

Browse files
Merge pull request #2046 from bersbersbers/partial-argument-match-warnings
Fix "partial argument match" warnings (#1977)
2 parents 2ef4a3f + dfdb6ff commit 4bb1e44

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

Diff for: NEWS.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# 4.10.0.9000
22

3+
## Improvements
4+
5+
* `ggplotly()` does not issue warnings with `options(warnPartialMatchArgs = TRUE)` any longer. (#2046, @bersbersbers)
36

47
# 4.10.0
58

Diff for: R/ggplotly.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ gg2list <- function(p, width = NULL, height = NULL,
182182
} else if (capabilities("jpeg")) {
183183
grDevices::jpeg
184184
} else if (system.file(package = "Cairo") != "") {
185-
Cairo::Cairo
185+
function(filename, ...) Cairo::Cairo(file = filename, ...)
186186
} else {
187187
stop(
188188
"No Cairo or bitmap device is available. Such a graphics device is required to convert sizes correctly in ggplotly().\n\n",
@@ -198,7 +198,7 @@ gg2list <- function(p, width = NULL, height = NULL,
198198
height <- height %||% default(grDevices::dev.size("px")[2])
199199
}
200200
# open the device and make sure it closes on exit
201-
dev_fun(file = tempfile(), width = width %||% 640, height = height %||% 480)
201+
dev_fun(filename = tempfile(), width = width %||% 640, height = height %||% 480)
202202
on.exit(grDevices::dev.off(), add = TRUE)
203203

204204
# check the value of dynamicTicks

Diff for: tests/testthat/test-ggplot-warnings.R

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
3+
test_that("ggplotly does not issue partial-argument-match warning", {
4+
p <- ggplot(data.frame())
5+
rlang::scoped_options(warnPartialMatchArgs = TRUE)
6+
expect_warning(ggplotly(p), regexp = NA)
7+
})

0 commit comments

Comments
 (0)