@@ -518,20 +518,26 @@ Guides <- ggproto(
518
518
for (i in seq_along(positions )) {
519
519
if (identical(positions [i ], " inside" )) {
520
520
# the actual inside position and justification can be set in each guide
521
- # by `theme` argument
522
- inside_justs [[i ]] <- valid.just(calc_element(
523
- " legend.justification.inside" , params [[i ]]$ theme
524
- )) %|| % default_inside_just
525
- inside_positions [[i ]] <- calc_element(
526
- " legend.position.inside" , params [[i ]]$ theme
527
- ) %|| % default_inside_position %|| % inside_justs [[i ]]
521
+ # by `theme` argument, here, we won't use `calc_element()` which will
522
+ # use inherits from `legend.justification` or `legend.position`, we only
523
+ # follow the inside elements from the guide theme
524
+ inside_just <- params [[i ]]$ theme [[" legend.justification.inside" ]]
525
+ if (is.null(inside_just )) {
526
+ inside_justs [[i ]] <- default_inside_just
527
+ } else {
528
+ inside_justs [[i ]] <- valid.just(inside_just )
529
+ }
530
+ inside_positions [[i ]] <- params [[i ]]$ theme [[
531
+ " legend.position.inside"
532
+ ]] %|| % default_inside_position %|| % inside_justs [[i ]]
528
533
groups [i ] <- paste(" inside" ,
529
534
paste(inside_positions [[i ]], collapse = " _" ),
530
535
paste(inside_justs [[i ]], collapse = " _" ),
531
536
sep = " _"
532
537
)
533
538
}
534
539
}
540
+
535
541
positions <- positions [keep ]
536
542
inside_positions <- inside_positions [keep ]
537
543
inside_justs <- inside_justs [keep ]
@@ -595,7 +601,7 @@ Guides <- ggproto(
595
601
596
602
# here, we put `inside_position` in the last, so that it won't break current
597
603
# implement of patchwork
598
- package_box = function (grobs , position , theme ,
604
+ package_box = function (grobs , position , theme ,
599
605
inside_position = NULL , inside_just = NULL ) {
600
606
if (is.zero(grobs ) || length(grobs ) == 0 ) {
601
607
return (zeroGrob())
0 commit comments