Adding job split figures
This commit is contained in:
parent
87ac709ff7
commit
95cece6aab
34
Visuals.r
34
Visuals.r
@ -1,15 +1,15 @@
|
||||
library(tidyverse)
|
||||
#install.packages("paletteer")
|
||||
library(scales)
|
||||
library(paletteer)
|
||||
DATA_DIR <- 'Results/REMI_Outputs'
|
||||
OUTPUT_DIR <- './Results/Figures'
|
||||
DATA_DIR <- 'Results/REMI_Output/'
|
||||
OUTPUT_DIR <- './Results/Figures/'
|
||||
dir.create(OUTPUT_DIR,recursive=TRUE,showWarnings=FALSE)
|
||||
######################Employments
|
||||
EMPLOY <- read_csv("Results/Direct, Indirect, and Induced -Employment.csv",skip=5) %>% pivot_longer(c(-Category,-Units),names_to="Year") %>% mutate(value=parse_number(value),Year=parse_number(Year))
|
||||
EMPLOY <- read_csv(paste0(DATA_DIR,"Direct, Indirect, and Induced -Employment.csv" ),skip=5) %>% pivot_longer(c(-Category,-Units),names_to="Year") %>% mutate(value=parse_number(value),Year=parse_number(Year))
|
||||
EMPLOY_NUM <- EMPLOY %>% filter(Units=='Individuals (Jobs)') %>% select(-Units,Employment=value) %>% filter(Year>=2028)
|
||||
EMPLOY_NUM <- rbind(EMPLOY_NUM %>% filter(!(Year %in% c(2028,2029))) ,EMPLOY_NUM %>% filter(Year==2028) %>% mutate(Year=2029.74),EMPLOY_NUM %>% filter(Year==2029) %>% mutate(Year=2029.75))
|
||||
|
||||
|
||||
EMPLOY_NUM$Category <- gsub(" Employment","",EMPLOY_NUM$Category)
|
||||
EMPLOY_NUM$Category <- factor(EMPLOY_NUM$Category,levels=rev(c("Direct","Indirect","Induced","Total")))
|
||||
|
||||
@ -19,13 +19,12 @@ COOL_DOWN <- as.numeric(EMPLOY_NUM[5,3])
|
||||
df <- data.frame(Year=c(2032.5,2034.25,2046,2059.8),Employment=c(MAX_VAL,COOL_DOWN,791+20,743+20),text=c("Peak of 2,530","Stablized at 961","Midpoint of 791","Ends at 743"))
|
||||
JOB_PLOT <- ggplot(EMPLOY_NUM %>% filter(Category!="Total"),aes(x=Year,y=Employment))+geom_area(position = "stack",aes(fill=Category,group=Category))+theme_bw()+scale_x_continuous(breaks=c(2028,seq(2025,2060,by=5)))+scale_fill_manual(values=COLORS)+geom_line(data=EMPLOY_NUM %>% filter(Category=="Total"),size=1)+geom_text(data=df,aes(label = text), vjust = "inward", hjust = "inward")+theme(legend.position = "top")
|
||||
|
||||
png("Job_plot.png", units = "in", width = 10, height = 8, res = 600)
|
||||
png(paste0(OUTPUT_DIR,"Job_plot.png" ) , units = "in", width = 10, height = 8, res = 600)
|
||||
JOB_PLOT
|
||||
dev.off()
|
||||
JOB_PLOT
|
||||
###################
|
||||
OUTPUT <- read_csv("Results/Direct, Indirect, and Induced -Output.csv",skip=5) %>% pivot_longer(c(-Category,-Units),names_to="Year") %>% mutate(value=parse_number(value),Year=parse_number(Year))
|
||||
OUTPUT
|
||||
#JOB_PLOT
|
||||
###################Output graph
|
||||
OUTPUT <- read_csv(paste0(DATA_DIR,"Direct, Indirect, and Induced -Output.csv" ),skip=5) %>% pivot_longer(c(-Category,-Units),names_to="Year") %>% mutate(value=parse_number(value),Year=parse_number(Year))
|
||||
OUTPUT_NUM <- OUTPUT %>% filter(Units=='Thousands of Fixed (2025) Dollars') %>% select(-Units,Output=value) %>% filter(Year>=2028) %>% mutate(Output=Output/1000)
|
||||
OUTPUT_NUM <- rbind(OUTPUT_NUM %>% filter(!(Year %in% c(2028,2029))) ,OUTPUT_NUM %>% filter(Year==2028) %>% mutate(Year=2029.74),OUTPUT_NUM %>% filter(Year==2029) %>% mutate(Year=2029.75))
|
||||
|
||||
@ -44,9 +43,20 @@ COOL_DOWN <- as.numeric(OUTPUT_NUM[5,3])
|
||||
df <- data.frame(Year=c(2032.5,2034.25,2059.8),Output=c(MAX_VAL,COOL_DOWN,337),text=c("Peak of $658 Million","Stablized at $273 Million ","Ends at $337 Million"))
|
||||
#OUTPUT_PLOT <-
|
||||
OUTPUT_NUM %>% filter(Year==2033)
|
||||
ggplot(OUTPUT_NUM %>% filter(Category!="Total"),aes(x=Year,y=Output))+geom_area(position = "stack",aes(fill=Category,group=Category))+theme_bw()+scale_x_continuous(breaks=c(2028,seq(2025,2060,by=5)))+scale_fill_manual(values=COLORS)+geom_line(data=OUTPUT_NUM %>% filter(Category=="Total"),size=1)
|
||||
+geom_text(data=df,aes(label = text), vjust = "inward", hjust = "inward")+theme(legend.position = "top")
|
||||
png("Output_plot.png", units = "in", width = 10, height = 8, res = 600)
|
||||
OUTPUT_PLOT <- ggplot(OUTPUT_NUM %>% filter(Category!="Total"),aes(x=Year,y=Output))+geom_area(position = "stack",aes(fill=Category,group=Category))+theme_bw()+scale_x_continuous(breaks=c(2028,seq(2025,2060,by=5)))+scale_fill_manual(values=COLORS)+geom_line(data=OUTPUT_NUM %>% filter(Category=="Total"),size=1)
|
||||
#+geom_text(data=df,aes(label = text), vjust = "inward", hjust = "inward")+theme(legend.position = "top")
|
||||
png(paste0(OUTPUT_DIR,"Output_plot.png"), units = "in", width = 10, height = 8, res = 600)
|
||||
OUTPUT_PLOT
|
||||
dev.off()
|
||||
###################
|
||||
INDUSTRY_JOBS <- read_csv(paste0(DATA_DIR,'Employment- By Industry - Employment by Industry.csv'),skip=5) %>% pivot_longer(c(-Industry,-Units),names_to="Year") %>% mutate(Jobs=parse_number(value),Year=parse_number(Year)) %>% select(-value) %>% filter(Industry!='All Industries') %>% select(-Units) %>% filter(Year>=2029)
|
||||
|
||||
|
||||
INDUSTRY_JOBS <- INDUSTRY_JOBS %>% group_by(Year) %>% mutate(Rank=rank(-Jobs)) %>% mutate(Rank=ifelse(Rank>10,11,Rank),Industry=ifelse(Rank==11,"Other",Industry)) %>% group_by(Year,Industry,Rank) %>% summarize(Jobs=sum(Jobs)) %>% ungroup(Industry,Rank) %>% arrange(Year,Rank)
|
||||
|
||||
ORDER <- c(INDUSTRY_JOBS %>% filter(Industry!='Other') %>% group_by(Industry) %>% summarize(MEAN=mean(Jobs)) %>% arrange(desc(MEAN)) %>% pull(Industry) %>% unique,"Other")
|
||||
INDUSTRY_JOBS$Industry <- factor(INDUSTRY_JOBS$Industry,levels=ORDER)
|
||||
|
||||
ggplot(INDUSTRY_JOBS ,aes(x=Year,y=Jobs,fill=Industry))+geom_bar(stat='identity')+ paletteer::scale_fill_paletteer_d("colorBlindness::Blue2DarkRed18Steps")
|
||||
ggplot(INDUSTRY_JOBS %>% filter(Year %in% c(2032,2045)),aes(x=as.factor(Year),y=Jobs,fill=Industry))+geom_bar(stat='identity')+ paletteer::scale_fill_paletteer_d("colorBlindness::Blue2DarkRed18Steps")
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user