Newer
Older
group_by(v_mean, v_first) %>%
summarise(ratio = last(scaled)/first(scaled)) %>%
mutate(bin_ratio = if_else((ratio*100)%%round_by > round_by*0.5,
ratio*100+(round_by-(ratio*100)%%round_by),
ratio*100-(ratio*100)%%round_by)) %>%
group_by(bin_ratio, v_first) %>%
summarise(v_mean = mean(v_mean)) %>%
mutate(bin_ratio = bin_ratio*0.01)
df_scenario = df_all %>%
filter(v_mean %in% df_scenario_info$fe_gj_pc) %>%
left_join(df_scenario_info, by=c("v_mean"="fe_gj_pc")) %>%
filter(!(scenario == "DLE"))
library(wesanderson)
a = df_all %>%
ggplot(aes(x=v_first, y=bin_ratio, fill=v_mean)) +
geom_tile() +
geom_hline(yintercept = ineq_curr, alpha=0.8, color="grey", linetype=2) +
geom_line(data=df_scenario, aes(color=scenario, group=scenario)) +
annotate(geom="text", x=max(df_all$v_first)-5.7,y=ineq_curr+0.6,label = "Current (2015) 10:10 ratio") +
#scale_fill_viridis("Mean energy\navailable") +
scale_fill_gradient("Mean energy\navailable (GJ/cap)",
low=wes_palette("Chevalier1")[3],
high = wes_palette("Rushmore1")[4]) +
theme_minimal() +
labs(x="Minimum energy requirement (GJ/cap)", y="Maximum energy inequality (10:10 ratio)", color = "Scenario")+
theme(text=element_text(family="Liberation Sans Narrow"),
axis.text.x = element_text(size = 13),
axis.text.y = element_text(size = 13)) +
scale_y_continuous(breaks = c(2.5,5,7.5,10,12.5)) # +
#theme_ipsum()
a
ggsave(here("analysis", "figures", "figureSxx.pdf"))
```
<!-- The following line ensures the references appear here for the MS Word or HTML output files, rather than right at the end of the document (this will not work for PDF files): -->
<div id="refs"></div>