Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions R/guides-.R
Original file line number Diff line number Diff line change
Expand Up @@ -941,13 +941,13 @@ redistribute_null_units <- function(units, spacing, margin, type = "width") {

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

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

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