Skip to content

Commit 85843e0

Browse files
committed
don't overwrite height/width since they set layout.width/layout.height
1 parent df0f339 commit 85843e0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

R/ggplotly.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ gg2list <- function(p, width = NULL, height = NULL, tooltip = "all",
117117

118118
# create a viewport so we can convert relative sizes correctly
119119
# if height/width not specified, it is estimated from current viewport (npc)
120-
width <- width %||% unitConvert(grid::unit(1, "npc"), "pixels", "width")
121-
height <- height %||% unitConvert(grid::unit(1, "npc"), "pixels", "height")
120+
widthVP <- width %||% unitConvert(grid::unit(1, "npc"), "pixels", "width")
121+
heightVP <- height %||% unitConvert(grid::unit(1, "npc"), "pixels", "height")
122122
# assume 96 dots per inch...mm2pixels also does this....
123123
vp <- grid::viewport(
124-
width = grid::unit(width * 72.27 / 96, "points"),
125-
height = grid::unit(height * 72.27 / 96, "points")
124+
width = grid::unit(widthVP * 72.27 / 96, "points"),
125+
height = grid::unit(heightVP * 72.27 / 96, "points")
126126
)
127127
grid::pushViewport(vp, recording = FALSE)
128128

0 commit comments

Comments
 (0)