-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrisk_agg_barplots.R
47 lines (34 loc) · 1.03 KB
/
trisk_agg_barplots.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
pipeline_trisk_agg_barplots <- function(){
}
prepare_for_trisk_agg_barplots <- function(){
}
draw_trisk_agg_barplots <- function(){
plot <-
ggplot(
plot_data,
aes(x = ald_business_unit, y = mean, fill = metric)
) +
geom_bar(stat = "identity", position = position_dodge()) +
geom_errorbar(aes(ymin = ci_lower, ymax = ci_upper),
width = 0.2,
position = position_dodge(0.9)
) +
facet_wrap(~metric, scales = "free_y") +
scale_fill_manual(values = c(
"Average NPV Rate of change" = "#5D9324",
"Average PD Difference" = "#BAB6B5"
)) +
scale_y_continuous(labels = scales::label_percent(accuracy = 1)) +
r2dii.plot::theme_2dii() +
theme(
axis.text.x = element_text(angle = 45, hjust = 1),
legend.position = "none"
) +
labs(y = "Average Value", x = "Business Unit") +
ggtitle(paste(
plot_data[1, "shock_scenario"] %>% pull(),
" - shock year :",
plot_data[1, "shock_year"] %>% pull()
))
return(plot)
}