@@ -480,7 +480,7 @@ Guides <- ggproto(
480480 if (length(default_position ) == 2 ) {
481481 default_position <- " inside"
482482 }
483- if (default_position == " none " ) {
483+ if (! default_position %in% c( .trbl , " inside " ) ) {
484484 return (zeroGrob())
485485 }
486486
@@ -547,7 +547,8 @@ Guides <- ggproto(
547547 legend.justification.inside = groups $ key $ justs [[i ]]
548548 )
549549 }
550- grobs [[i ]] <- self $ package_box(grobs [[i ]], position , theme + adjust )
550+ adjust <- add_theme(theme , adjust , " internal theme settings" )
551+ grobs [[i ]] <- self $ package_box(grobs [[i ]], position , adjust )
551552 }
552553
553554 # merge inside grobs into single gtable
@@ -598,11 +599,7 @@ Guides <- ggproto(
598599 }
599600
600601 # Determine default direction
601- direction <- switch (
602- position ,
603- inside = , left = , right = " vertical" ,
604- top = , bottom = " horizontal"
605- )
602+ direction <- switch (position , top = , bottom = " horizontal" , " vertical" )
606603
607604 # Populate missing theme arguments
608605 theme $ legend.box <- theme $ legend.box %|| % direction
0 commit comments