diff --git a/R/guides-.R b/R/guides-.R index 0e7ca26882..03c6ad6ce7 100644 --- a/R/guides-.R +++ b/R/guides-.R @@ -479,7 +479,7 @@ Guides <- ggproto( if (length(default_position) == 2) { default_position <- "inside" } - if (default_position == "none") { + if (!default_position %in% c(.trbl, "inside")) { return(zeroGrob()) } @@ -546,7 +546,8 @@ Guides <- ggproto( legend.justification.inside = groups$key$justs[[i]] ) } - grobs[[i]] <- self$package_box(grobs[[i]], position, theme + adjust) + adjust <- add_theme(theme, adjust, "internal theme settings") + grobs[[i]] <- self$package_box(grobs[[i]], position, adjust) } # merge inside grobs into single gtable @@ -597,11 +598,7 @@ Guides <- ggproto( } # Determine default direction - direction <- switch( - position, - inside = , left = , right = "vertical", - top = , bottom = "horizontal" - ) + direction <- switch(position, top = , bottom = "horizontal", "vertical") # Populate missing theme arguments theme$legend.box <- theme$legend.box %||% direction