Skip to content

Commit 03b67ca

Browse files
committed
Merge branch 'master' into sf-grob
2 parents 3217e3d + 89e0cd8 commit 03b67ca

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
## BUG FIXES
1313

1414
* Fixed algorithm for coercing the proposed layout to the plot schema (see #1156).
15+
* grid conversions in `ggplotly()` weren't respected a specified `height`/`width` in RStudio (see #1190).
1516

1617
# 4.7.1
1718

R/ggplotly.R

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,6 @@ gg2list <- function(p, width = NULL, height = NULL,
171171
# To avoid undesirable side effects, we may need to open a
172172
# non-interactive device and close it on exit...
173173
# https://github.com/att/rcloud.htmlwidgets/issues/2
174-
175-
# Note that we never have to open a non-interactive device
176-
# in RStudio since it ships with one. Plus, calling dev.size()
177-
# adds it to dev.list() & should ensure grid can query the correct device size
178-
rStudioDevSize <- if (is_rstudio()) grDevices::dev.size("px")
179-
180174
if (is.null(grDevices::dev.list())) {
181175
dev_fun <- if (system.file(package = "Cairo") != "") {
182176
Cairo::Cairo
@@ -194,7 +188,9 @@ gg2list <- function(p, width = NULL, height = NULL,
194188
call. = FALSE
195189
)
196190
}
197-
dev_fun(file = tempfile(), width = width %||% 640, height = height %||% 480)
191+
width <- width %||% grDevices::dev.size("px")[1] %||% 640
192+
height <- height %||% grDevices::dev.size("px")[2] %||% 480
193+
dev_fun(file = tempfile(), width = width, height = height)
198194
on.exit(grDevices::dev.off(), add = TRUE)
199195
}
200196

0 commit comments

Comments
 (0)