Skip to content
Merged
Show file tree
Hide file tree
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/guide-colorbar.R
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,10 @@ GuideColourbar <- ggproto(
# We set the defaults in `theme` so that the `params$theme` can still
# overrule defaults given here
if (params$direction == "horizontal") {
theme$legend.key.width <- rel(5)
theme$legend.key.width <- (theme$legend.key.width %||% rel(1)) * 5
valid_position <- c("bottom", "top")
} else {
theme$legend.key.height <- rel(5)
theme$legend.key.height <- (theme$legend.key.height %||% rel(1)) * 5
valid_position <- c("right", "left")
}

Expand Down
6 changes: 5 additions & 1 deletion R/guides-.R
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,11 @@

# 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))
if (length(units) < 2) {
spacing <- unit(0, "cm")

Check warning on line 945 in R/guides-.R

View check run for this annotation

Codecov / codecov/patch

R/guides-.R#L945

Added line #L945 was not covered by tests
} else {
spacing <- sum(rep(spacing, length.out = length(units) - 1))
}
margin <- switch(type, width = margin[c(2, 4)], height = margin[c(1, 3)])
margin <- sum(size(margin))

Expand Down