Skip to content

Commit f7a3f30

Browse files
committed
resolve spacing once
1 parent b2f5a43 commit f7a3f30

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

R/guides-.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,11 @@ Guides <- ggproto(
509509
MoreArgs = list(theme = theme)
510510
)
511511

512+
# Set spacing
513+
theme$legend.spacing <- theme$legend.spacing %||% unit(0.5, "lines")
514+
theme$legend.spacing.y <- theme$legend.spacing.y %||% theme$legend.spacing
515+
theme$legend.spacing.x <- theme$legend.spacing.x %||% theme$legend.spacing
516+
512517
Map(
513518
grobs = grobs,
514519
position = levels(positions),
@@ -538,11 +543,6 @@ Guides <- ggproto(
538543
top = , bottom = c("center", "top")
539544
)
540545

541-
# Set spacing
542-
theme$legend.spacing <- theme$legend.spacing %||% unit(0.5, "lines")
543-
theme$legend.spacing.y <- theme$legend.spacing.y %||% theme$legend.spacing
544-
theme$legend.spacing.x <- theme$legend.spacing.x %||% theme$legend.spacing
545-
546546
# Measure guides
547547
widths <- lapply(grobs, function(g) sum(g$widths))
548548
widths <- inject(unit.c(!!!widths))

0 commit comments

Comments
 (0)