diff --git a/IMPLAN_Visuals.r b/IMPLAN_Visuals.r index 4401858..bcb3760 100644 --- a/IMPLAN_Visuals.r +++ b/IMPLAN_Visuals.r @@ -1,4 +1,5 @@ library(tidyverse) +library(scales) GET_DATA <- function(){ GET_FILE_US <- function(YEAR){read_csv(paste0("Model_Outputs/IMPLAN/US/US_",YEAR,"/economic_indicators_by_impact.csv")) %>% mutate(year=YEAR) %>% filter(!is.na(Impact))%>% mutate(Region="US") } GET_FILE_WY <- function(YEAR){read_csv(paste0("Model_Outputs/IMPLAN/Wyoming/WY_",YEAR,"/economic_indicators_by_impact.csv")) %>% mutate(year=YEAR) %>% filter(!is.na(Impact))%>% mutate(Region="WY") } @@ -23,8 +24,27 @@ DATA$Type <- factor(DATA$Type,levels=c("Direct","Indirect","Induced")) DATA EMP_WY <- DATA %>% filter(Impact=="Employment",Region=="WY") DOL_WY <- DATA %>% filter(Impact!="Employment",Region=="WY") -ggplot(EMP_WY, aes(x = year, y = value, fill = Type)) + geom_area(stat = "identity", position = "stack") + theme_bw()+scale_x_continuous(breaks=2026:2060)+scale_y_continuous(breaks=seq(0,10000,by=250))+ylab("Wyoming Employment Additions\n(Full-time Equivalent)") - ?scale_y_continuous -ggplot(DOL_WY, aes(x = year, y = value/10^9, fill = Type)) + geom_bar(stat = "identity", position = "stack") + theme_minimal()+facet_wrap(~Impact) +EMP <- DATA %>% filter(Impact=="Employment") + +ALL_EMP <- EMP %>% group_by(Region,year) %>% summarize(value=sum(value)) %>% ungroup() +ALL_EMP <- ALL_EMP %>% group_by(year) %>% mutate(value=ifelse(Region=='US',value-min(value),value)) + +DOLLAR <-DATA %>% filter(Impact!="Employment") + +ALL_DOLLAR <-DOLLAR %>% group_by(Region,year,Impact) %>% summarize(value=sum(value)) +ALL_DOLLAR <- ALL_DOLLAR %>% group_by(year,Impact) %>% mutate(value=ifelse(Region=='US',value-min(value),value)) + + +ggplot(EMP, aes(x = year, y = value, fill = Type)) + geom_area(stat = "identity", position = "stack") + theme_bw()+scale_x_continuous(breaks=2026:2060)+scale_y_continuous(breaks=seq(0,10000,by=250))+ylab("Wyoming Employment Additions\n(Full-time Equivalent)")+facet_wrap(~Region) + + +WY_US_EMP_PLOT <- ggplot(ALL_EMP, aes(x = year, y = value, fill = Region)) + geom_area(stat = "identity", position = "stack") + theme_bw()+scale_x_continuous(breaks=seq(2026,2060,by=2))+scale_y_continuous(breaks=seq(0,100000,by=1000),labels = label_comma())+ylab("Employment Additions (FTE)")+scale_fill_manual(values=c("#0A3161","#FFC425"))+theme(legend.position = "top",text = element_text(size = 20)) +ggsave(filename = "Employment_Plot.png", plot = WY_US_EMP_PLOT, width = 2*6.5, height = 2*4.0, units = "in", dpi = 600 ) +ALL_DOLLAR$Impact <- factor(ALL_DOLLAR$Impact,levels=c("Output","Value Added","Income")) +WY_US_VALUE_ADD <- ggplot(ALL_DOLLAR, aes(x = year, y = value/10^9, fill = Region)) + geom_area(stat = "identity", position = "stack") + theme_bw()+scale_x_continuous(breaks=seq(2026,2060,by=2))+scale_y_continuous(breaks=seq(0,10000,by=0.5),labels = label_comma())+ylab("Billion Dollars (2026 USD)")+scale_fill_manual(values=c("#0A3161","#FFC425"))+theme(legend.position = "top",text = element_text(size = 20))+facet_wrap(~Impact,ncol=1) + + +ggsave(filename = "Impact_Plot.png", plot = WY_US_VALUE_ADD, width = 2*6.5, height = 6*4.0, units = "in", dpi = 600 ) +