File tree Expand file tree Collapse file tree 1 file changed +35
-10
lines changed
Expand file tree Collapse file tree 1 file changed +35
-10
lines changed Original file line number Diff line number Diff line change @@ -672,18 +672,43 @@ forest_plot <- function(
672672 color = ref_value_col
673673 )
674674 }
675- if (show_ref_value &&
676- ref_value_by_panel &&
677- ! is.null(ref_value_by_panel_data )) {
675+ if (ref_value_by_panel && ! is.null(ref_value_by_panel_data ) ) {
676+ if (show_ref_area ){
678677 main_plot <- main_plot +
679- ggplot2 :: geom_vline(data = ref_value_by_panel_data ,
680- ggplot2 :: aes(xintercept = xintercept ,
681- linetype = ref_legend_text ),
682- size = ref_value_size ,
683- color = ref_value_col
684- )
678+ ggplot2 :: geom_rect(data = ref_value_by_panel_data ,
679+ ggplot2 :: aes(xmin = xintercept * min(ref_area ),
680+ xmax = xintercept * max(ref_area ),
681+ ymin = - Inf ,
682+ ymax = Inf ),
683+ fill = ref_area_col ,
684+ inherit.aes = FALSE ,
685+ )+
686+ ggplot2 :: geom_ribbon(
687+ data = ref_value_by_panel_data %> %
688+ mutate(x = xintercept ,
689+ ymax = Inf ,
690+ ymin = - Inf ,
691+ fill = area_legend_text ),
692+ ggplot2 :: aes(
693+ x = x ,
694+ ymax = ymax ,
695+ ymin = ymin ,
696+ fill = fill
697+ ),
698+ size = 1 ,
699+ inherit.aes = FALSE
700+ )
701+ }
702+ if (show_ref_value ){
703+ main_plot <- main_plot +
704+ ggplot2 :: geom_vline(data = ref_value_by_panel_data ,
705+ ggplot2 :: aes(xintercept = xintercept ,
706+ linetype = ref_legend_text ),
707+ size = ref_value_size ,
708+ color = ref_value_col
709+ )
710+ }
685711 }
686-
687712 main_plot <- main_plot +
688713 ggplot2 :: geom_pointrange(
689714 position = ggplot2 :: position_dodge(width = vertical_dodge_height ),
You can’t perform that action at this time.
0 commit comments