Skip to content

Commit 42149bb

Browse files
committed
fix redistribute_null_units
1 parent 7798431 commit 42149bb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

R/guides-.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -941,13 +941,13 @@ redistribute_null_units <- function(units, spacing, margin, type = "width") {
941941

942942
# Get spacing between guides and margins in absolute units
943943
size <- switch(type, width = width_cm, height = height_cm)
944-
spacing <- sum(rep(spacing, length.out = length(units) - 1))
944+
sum_spacing <- sum(rep(size(spacing), length.out = length(units) - 1))
945945
margin <- switch(type, width = margin[c(2, 4)], height = margin[c(1, 3)])
946946
margin <- sum(size(margin))
947947

948948
# Get the absolute parts of the unit
949949
absolute <- vapply(units, function(u) sum(size(absolute.size(u))), numeric(1))
950-
absolute_sum <- sum(absolute) + sum(size(spacing)) + margin
950+
absolute_sum <- sum(absolute) + sum_spacing + margin
951951

952952
# Get the null parts of the unit
953953
num_null <- function(x) sum(as.numeric(x)[unitType(x) == "null"])

0 commit comments

Comments
 (0)