Skip to content

Commit 006b69a

Browse files
committed
In contrast to attr(x, unit), the new grid::unitType() function always return a vector the same length as it's input
1 parent b5cbae3 commit 006b69a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

R/ggplotly.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -1137,8 +1137,8 @@ unitConvert <- function(u, to = c("npc", "pixels"), type = c("x", "y", "height",
11371137
# from R, but it seems 96 is a reasonable assumption.
11381138
mm2pixels <- function(u) {
11391139
u <- verifyUnit(u)
1140-
if (getUnitType(u) != "mm") {
1141-
stop("Unit must be in millimeters")
1140+
if (any(getUnitType(u) != "mm")) {
1141+
stop("All units must be in millimeters")
11421142
}
11431143
(as.numeric(u) * 96) / 25.4
11441144
}

0 commit comments

Comments
 (0)