@@ -584,21 +584,25 @@ Guides <- ggproto(
584
584
stretch_x <- any(unlist(lapply(widths , unitType )) == " null" )
585
585
stretch_y <- any(unlist(lapply(heights , unitType )) == " null" )
586
586
587
- # Global justification of the complete legend box
588
- global_just <- paste0(" legend.justification." , position )
589
- global_just <- valid.just(calc_element(global_just , theme ))
590
587
if (startsWith(position , " inside" )) {
588
+ # Global justification of the complete legend box
589
+ global_just <- valid.just(calc_element(
590
+ " legend.justification.inside" , theme
591
+ ))
591
592
# for inside guide legends, the position was attached in
592
593
# each grob of the input grobs (which should share the same position)
593
594
inside_position <- attr(.subset2(grobs , 1L ), " inside_position" ) %|| %
594
- # fallback to original method of ggplot2 <=3.3.5
595
+ # fallback to original method of ggplot2 <=3.5.1
595
596
.subset2(theme , " legend.position.inside" ) %|| % global_just
596
597
global_xjust <- global_just [1 ]
597
598
global_yjust <- global_just [2 ]
598
599
x <- inside_position [1 ]
599
600
y <- inside_position [2 ]
600
601
global_margin <- margin()
601
602
} else {
603
+ # Global justification of the complete legend box
604
+ global_just <- paste0(" legend.justification." , position )
605
+ global_just <- valid.just(calc_element(global_just , theme ))
602
606
x <- global_xjust <- global_just [1 ]
603
607
y <- global_yjust <- global_just [2 ]
604
608
# Legends to the side of the plot need a margin for justification
0 commit comments