Skip to content

Commit f584b40

Browse files
committed
fallback for invalid legend.position
1 parent 5e6028e commit f584b40

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

R/guides-.R

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ Guides <- ggproto(
479479
if (length(default_position) == 2) {
480480
default_position <- "inside"
481481
}
482-
if (default_position == "none") {
482+
if (!default_position %in% c(.trbl, "inside")) {
483483
return(zeroGrob())
484484
}
485485

@@ -598,11 +598,7 @@ Guides <- ggproto(
598598
}
599599

600600
# Determine default direction
601-
direction <- switch(
602-
position,
603-
inside = , left = , right = "vertical",
604-
top = , bottom = "horizontal"
605-
)
601+
direction <- switch(position, top = , bottom = "horizontal", "vertical")
606602

607603
# Populate missing theme arguments
608604
theme$legend.box <- theme$legend.box %||% direction

0 commit comments

Comments
 (0)