diff --git a/NEWS.md b/NEWS.md index a71da718f9..56775ea13a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ # 4.10.0.9000 +## Improvements + +* `ggplotly()` does not issue warnings with `options(warnPartialMatchArgs = TRUE)` any longer. (#2046, @bersbersbers) # 4.10.0 diff --git a/R/ggplotly.R b/R/ggplotly.R index 6db8b6547b..c9ccda8bc7 100644 --- a/R/ggplotly.R +++ b/R/ggplotly.R @@ -182,7 +182,7 @@ gg2list <- function(p, width = NULL, height = NULL, } else if (capabilities("jpeg")) { grDevices::jpeg } else if (system.file(package = "Cairo") != "") { - Cairo::Cairo + function(filename, ...) Cairo::Cairo(file = filename, ...) } else { stop( "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, height <- height %||% default(grDevices::dev.size("px")[2]) } # open the device and make sure it closes on exit - dev_fun(file = tempfile(), width = width %||% 640, height = height %||% 480) + dev_fun(filename = tempfile(), width = width %||% 640, height = height %||% 480) on.exit(grDevices::dev.off(), add = TRUE) # check the value of dynamicTicks diff --git a/tests/testthat/test-ggplot-warnings.R b/tests/testthat/test-ggplot-warnings.R new file mode 100644 index 0000000000..f72dfcee22 --- /dev/null +++ b/tests/testthat/test-ggplot-warnings.R @@ -0,0 +1,7 @@ + + +test_that("ggplotly does not issue partial-argument-match warning", { + p <- ggplot(data.frame()) + rlang::scoped_options(warnPartialMatchArgs = TRUE) + expect_warning(ggplotly(p), regexp = NA) +})