Skip to content

Commit 273b1ed

Browse files
committed
Address BDR's email about preferring png() when aqua capabilities are available
Also, prefer jpeg over Cairo since it doesn't really matter what device we use, and it seems Cairo will need to be reinstalled in R 4.1 for it to work
1 parent 4a33aea commit 273b1ed

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

R/ggplotly.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,12 @@ gg2list <- function(p, width = NULL, height = NULL,
176176

177177
# To convert relative sizes correctly, we use grid::convertHeight(),
178178
# which requires a known output (device) size.
179-
dev_fun <- if (system.file(package = "Cairo") != "") {
180-
Cairo::Cairo
181-
} else if (capabilities("png")) {
179+
dev_fun <- if (capabilities("aqua") || capabilities("png")) {
182180
grDevices::png
183181
} else if (capabilities("jpeg")) {
184182
grDevices::jpeg
183+
} else if (system.file(package = "Cairo") != "") {
184+
Cairo::Cairo
185185
} else {
186186
stop(
187187
"No Cairo or bitmap device is available. Such a graphics device is required to convert sizes correctly in ggplotly().\n\n",

0 commit comments

Comments
 (0)