Skip to content

Commit 73d98c5

Browse files
committed
deal with old R units
1 parent df59328 commit 73d98c5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

R/plot-build.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,12 @@ table_add_legends <- function(table, legends, theme) {
412412
}
413413

414414
# Extract sizes
415-
widths <- lapply(legends, function(x) unit(gtable_width(x), "pt"))
416-
heights <- lapply(legends, function(x) unit(gtable_height(x), "pt"))
415+
widths <- heights <- set_names(
416+
rep(list(unit(0, "pt")), length(legends)),
417+
names(legends)
418+
)
419+
widths[!empty] <- lapply(legends[!empty], gtable_width)
420+
heights[!empty] <- lapply(legends[!empty], gtable_height)
417421
spacing <- theme$legend.box.spacing %||% unit(0.2, "cm")
418422

419423
# Set the justification of the legend box

0 commit comments

Comments
 (0)