Private Car Fleet by Automation Level

Row

Reference - Full View

Reference - Scenario 1

Reference - Scenario 2

Reference - Scenario 3

Reference - Scenario 4

Reference - SET 4 Sample

Row

Scenario - Full View

Scenario - Scenario 1

Scenario - Scenario 2

Scenario - Scenario 3

Scenario - Scenario 4

Scenario - SET 4 Sample

Fleet from Population by Car Availability

Row

Reference - Full View

Reference - Scenario 1

Reference - Scenario 2

Reference - Scenario 3

Reference - Scenario 4

Reference - SET 4 Sample

Row

Scenario - Full View

Scenario - Scenario 1

Scenario - Scenario 2

Scenario - Scenario 3

Scenario - Scenario 4

Scenario - SET 4 Sample

--- 
title: "Output Analysis"
author: "Scenario Model"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    social: menu
    source_code: embed
    theme: yeti
--- 

```{r setup, include=FALSE}
library(tidyr)
library(stringr)
library(ggplot2)
library(ggthemes)
library(dplyr)
library(readr)
library(lubridate)
library(readxl)
library(plotly)
library(prettydoc)
library(flexdashboard)

# Preparing the Datasets

## File Paths Creation

setwd("C:/Users/abraham/Desktop/SCE_summary")
directory_TRT <- getwd()
directory = directory_TRT


## Select the set desidered to load putting the SCE_X in the xl_file direction

xl_file <- "raw_Data/SCE_allSets.xlsx"
xl_data <- paste(directory,xl_file, sep = "/")


# Import all Sheets with given Names from Excel File


tab_names <- excel_sheets(path = xl_data)

list_all <- lapply(tab_names, function(x) read_excel(path = xl_data, sheet = x))


prefx_data <- "df_"
xl_st <- c(1:length(list_all))
for(i in 1:length(xl_st)){
        assign(
                paste(prefx_data, tab_names, sep = "")[i], list_all[[i]]
        ) }

# Levels Colour Palette

C2 <- c("#D98C5F","#444F65")
C4 <- c("#536A73", "#B3AF81","#A6888F","#594046")
C6 <- c("#37404A","#598544", "#88CC68","#7CB3B8", "#E0AE67", "#C0645B")

# Clean enviroment

rm(df_Paste, list_all)

# Tidying it 

df_SCE <- gather(df_ALL, YEAR, VALUE, "2020":"2050")
df_SCE <- tbl_df(df_SCE)

new_colnames <- c("SCE","SET", "KEY", "VARIABLE", "CarAvail", "RoadVehicle", "Level", "VehicleType", "Engine", "TruckService", "TruckType", "YEAR", "VALUE")
names(df_SCE) <- new_colnames


df_SCE$SCE <- as.factor(df_SCE$SCE)
df_SCE$SET <- as.factor(df_SCE$SET)
df_SCE$VARIABLE <- as.factor(df_SCE$VARIABLE)
df_SCE$CarAvail <- as.factor(df_SCE$CarAvail)
df_SCE$RoadVehicle <- as.factor(df_SCE$RoadVehicle)
df_SCE$VehicleType <- as.factor(df_SCE$VehicleType)
df_SCE$Level <- as.factor(df_SCE$Level)
df_SCE$Engine <- as.factor(df_SCE$Engine)
df_SCE$TruckService <- as.factor(df_SCE$TruckService)
df_SCE$TruckType <- as.factor(df_SCE$TruckType)

df_SCE$YEAR <- as.numeric(df_SCE$YEAR)
df_SCE$YEAR <- as.Date(as.character(df_SCE$YEAR), format = "%Y")
df_SCE$YEAR <- year(df_SCE$YEAR)


```

Private Car Fleet by Automation Level
=======================================================================

Row {.tabset .tabset-fade}
-----------------------------------------------------------------------

### Reference - Full View

```{r CarsFleet_Full_View_Ref}

x <- "Base_Final_Private_cars_fleet"

df_GRAPH = df_SCE %>% filter(VARIABLE == x) %>% group_by(SET)

g <- ggplot(df_GRAPH, aes(x = YEAR,
                          y = VALUE,
                          fill = Level,)) +
        geom_bar(stat="Identity", width=0.65) +
        facet_grid(SCE ~ SET) +
        labs(title = x, subtitle = "") +
        xlab("") +
        ylab("") +
        scale_x_discrete() + 
        scale_y_continuous()  +
        scale_fill_manual(values = C6) +
        theme_light() +
        theme(axis.text.x = element_text(angle=45, vjust = 0),
              plot.title = element_text(hjust = 0.5, vjust = 0.5), 
              plot.subtitle = element_text(hjust = 0.5, vjust = 0.5))

gp <- ggplotly(g) %>% 
        layout(legend = list(orientation = "h", y = 0, x = 0.35))
gp

```

### Reference - Scenario 1

```{r CarsFleet_Ref_SCE_1}

SCE_x = "SCE_1"

df_GRAPH = df_SCE %>% filter(VARIABLE == x, ) %>% filter(SCE == SCE_x) 

g <- ggplot(df_GRAPH, aes(x = YEAR,
                          y = VALUE,
                          fill = Engine,)) +
        geom_bar(stat="Identity", width=0.65) +
        facet_grid(Level ~ SET) +
        labs(title = x, subtitle = SCE_x) +
        xlab("") +
        ylab("") +
        scale_x_discrete() + 
        scale_y_continuous() +
        scale_fill_manual(values = C2) +
        theme_light() +
        theme(axis.text.x = element_text(angle=45, vjust = 0),
              plot.title = element_text(hjust = 0.5, vjust = 0.5), 
              plot.subtitle = element_text(hjust = 0.5, vjust = 0.5))

  
gp <- ggplotly(g) %>% 
        layout(legend = list(orientation = "h", y = 0, x = 0.35))
gp

```

### Reference - Scenario 2

```{r CarsFleet_Ref_SCE_2}

SCE_x = "SCE_2"

df_GRAPH = df_SCE %>% filter(VARIABLE == x, ) %>% filter(SCE == SCE_x) 

g <- ggplot(df_GRAPH, aes(x = YEAR,
                          y = VALUE,
                          fill = Engine,)) +
        geom_bar(stat="Identity", width=0.65) +
        facet_grid(Level ~ SET) +
        labs(title = x, subtitle = SCE_x) +
        xlab("") +
        ylab("") +
        scale_x_discrete() + 
        scale_y_continuous() +
        scale_fill_manual(values = C2) +
        theme_light() +
        theme(axis.text.x = element_text(angle=45, vjust = 0),
              plot.title = element_text(hjust = 0.5, vjust = 0.5), 
              plot.subtitle = element_text(hjust = 0.5, vjust = 0.5))

  
gp <- ggplotly(g) %>% 
        layout(legend = list(orientation = "h", y = 0, x = 0.35))
gp

```

### Reference - Scenario 3

```{r CarsFleet_Ref_SCE_3}

SCE_x = "SCE_3"

df_GRAPH = df_SCE %>% filter(VARIABLE == x, ) %>% filter(SCE == SCE_x) 

g <- ggplot(df_GRAPH, aes(x = YEAR,
                          y = VALUE,
                          fill = Engine,)) +
        geom_bar(stat="Identity", width=0.65) +
        facet_grid(Level ~ SET) +
        labs(title = x, subtitle = SCE_x) +
        xlab("") +
        ylab("") +
        scale_x_discrete() + 
        scale_y_continuous() +
        scale_fill_manual(values = C2) +
        theme_light() +
        theme(axis.text.x = element_text(angle=45, vjust = 0),
              plot.title = element_text(hjust = 0.5, vjust = 0.5), 
              plot.subtitle = element_text(hjust = 0.5, vjust = 0.5))

  
gp <- ggplotly(g) %>% 
        layout(legend = list(orientation = "h", y = 0, x = 0.35))
gp

```

### Reference - Scenario 4

```{r CarsFleet_Ref_SCE_4}

SCE_x = "SCE_4"

df_GRAPH = df_SCE %>% filter(VARIABLE == x, ) %>% filter(SCE == SCE_x) 

g <- ggplot(df_GRAPH, aes(x = YEAR,
                          y = VALUE,
                          fill = Engine,)) +
        geom_bar(stat="Identity", width=0.65) +
        facet_grid(Level ~ SET) +
        labs(title = x, subtitle = SCE_x) +
        xlab("") +
        ylab("") +
        scale_x_discrete() + 
        scale_y_continuous() +
        scale_fill_manual(values = C2) +
        theme_light() +
        theme(axis.text.x = element_text(angle=45, vjust = 0),
              plot.title = element_text(hjust = 0.5, vjust = 0.5), 
              plot.subtitle = element_text(hjust = 0.5, vjust = 0.5))

  
gp <- ggplotly(g) %>% 
        layout(legend = list(orientation = "h", y = 0, x = 0.35))
gp

```

### Reference - SET 4 Sample

```{r CarsFleet Reference_set_4}

x <- "Base_Final_Private_cars_fleet"

df_GRAPH = df_SCE %>% filter(VARIABLE == x, ) %>% filter(SET == "set_4")

g <- ggplot(df_GRAPH, aes(x = YEAR,
                          y = VALUE,
                          fill = Level,)) +
        geom_bar(stat="Identity", width=0.65) +
        facet_grid(. ~ SCE) +
        labs(title = x, subtitle = "Set_4") +
        xlab("") +
        ylab("") +
        scale_x_discrete() + 
        scale_y_continuous() +
        scale_fill_manual(values = C6) +
        theme_light() +
        theme(axis.text.x = element_text(angle=45, vjust = 0),
              plot.title = element_text(hjust = 0.5, vjust = 0.5), 
              plot.subtitle = element_text(hjust = 0.5, vjust = 0.5))
  
gp <- ggplotly(g) %>% 
        layout(legend = list(orientation = "h", y = 0, x = 0.35))
gp

```

Row {.tabset .tabset-fade}
-----------------------------------------------------------------------

### Scenario - Full View

```{r CarsFleet_Full_view_SCE}

x <- "Final_Private_cars_fleet"

df_GRAPH = df_SCE %>% filter(VARIABLE == x) %>% group_by(SET)

g <- ggplot(df_GRAPH, aes(x = YEAR,
                          y = VALUE,
                          fill = Level,)) +
        geom_bar(stat="Identity", width=0.65) +
        facet_grid(SCE ~ SET) +
        labs(title = x, subtitle = "") +
        xlab("") +
        ylab("") +
        scale_x_discrete() + 
        scale_y_continuous() +
        scale_fill_manual(values = C6) +
        theme_light() +
        theme(axis.text.x = element_text(angle=45, vjust = 0),
              plot.title = element_text(hjust = 0.5, vjust = 0.5), 
              plot.subtitle = element_text(hjust = 0.5, vjust = 0.5))

gp <- ggplotly(g) %>% 
        layout(legend = list(orientation = "h", y = 0, x = 0.35))
gp

```

### Scenario - Scenario 1

```{r CarsFleet SCE_1}

SCE_x = "SCE_1"

df_GRAPH = df_SCE %>% filter(VARIABLE == x, ) %>% filter(SCE == SCE_x) 

g <- ggplot(df_GRAPH, aes(x = YEAR,
                          y = VALUE,
                          fill = Engine,)) +
        geom_bar(stat="Identity", width=0.65) +
        facet_grid(Level ~ SET) +
        labs(title = x, subtitle = SCE_x) +
        xlab("") +
        ylab("") +
        scale_x_discrete() + 
        scale_y_continuous() +
        scale_fill_manual(values = C2) +
        theme_light() +
        theme(axis.text.x = element_text(angle=45, vjust = 0),
              plot.title = element_text(hjust = 0.5, vjust = 0.5), 
              plot.subtitle = element_text(hjust = 0.5, vjust = 0.5))


  
gp <- ggplotly(g) %>% 
        layout(legend = list(orientation = "h", y = 0, x = 0.35))
gp

```

### Scenario - Scenario 2

```{r CarsFleet SCE_2}

SCE_x = "SCE_2"

df_GRAPH = df_SCE %>% filter(VARIABLE == x, ) %>% filter(SCE == SCE_x) 

g <- ggplot(df_GRAPH, aes(x = YEAR,
                          y = VALUE,
                          fill = Engine,)) +
        geom_bar(stat="Identity", width=0.65) +
        facet_grid(Level ~ SET) +
        labs(title = x, subtitle = SCE_x) +
        xlab("") +
        ylab("") +
        scale_x_discrete() + 
        scale_y_continuous() +
        scale_fill_manual(values = C2) +
        theme_light() +
        theme(axis.text.x = element_text(angle=45, vjust = 0),
              plot.title = element_text(hjust = 0.5, vjust = 0.5), 
              plot.subtitle = element_text(hjust = 0.5, vjust = 0.5))


  
gp <- ggplotly(g) %>% 
        layout(legend = list(orientation = "h", y = 0, x = 0.35))
gp

```

### Scenario - Scenario 3

```{r CarsFleet SCE_3}

SCE_x = "SCE_3"

df_GRAPH = df_SCE %>% filter(VARIABLE == x, ) %>% filter(SCE == SCE_x) 

g <- ggplot(df_GRAPH, aes(x = YEAR,
                          y = VALUE,
                          fill = Engine,)) +
        geom_bar(stat="Identity", width=0.65) +
        facet_grid(Level ~ SET) +
        labs(title = x, subtitle = SCE_x) +
        xlab("") +
        ylab("") +
        scale_x_discrete() + 
        scale_y_continuous() +
        scale_fill_manual(values = C2) +
        theme_light() +
        theme(axis.text.x = element_text(angle=45, vjust = 0),
              plot.title = element_text(hjust = 0.5, vjust = 0.5), 
              plot.subtitle = element_text(hjust = 0.5, vjust = 0.5))


  
gp <- ggplotly(g) %>% 
        layout(legend = list(orientation = "h", y = 0, x = 0.35))
gp

```

### Scenario - Scenario 4

```{r CarsFleet SCE_4}

SCE_x = "SCE_4"

df_GRAPH = df_SCE %>% filter(VARIABLE == x, ) %>% filter(SCE == SCE_x) 

g <- ggplot(df_GRAPH, aes(x = YEAR,
                          y = VALUE,
                          fill = Engine,)) +
        geom_bar(stat="Identity", width=0.65) +
        facet_grid(Level ~ SET) +
        labs(title = x, subtitle = SCE_x) +
        xlab("") +
        ylab("") +
        scale_x_discrete() + 
        scale_y_continuous() +
        scale_fill_manual(values = C2) +
        theme_light() +
        theme(axis.text.x = element_text(angle=45, vjust = 0),
              plot.title = element_text(hjust = 0.5, vjust = 0.5), 
              plot.subtitle = element_text(hjust = 0.5, vjust = 0.5))


  
gp <- ggplotly(g) %>% 
        layout(legend = list(orientation = "h", y = 0, x = 0.35))
gp

```

### Scenario - SET 4 Sample

```{r CarsFleet SCE_set_4}

x <- "Final_Private_cars_fleet"

df_GRAPH = df_SCE %>% filter(VARIABLE == x, ) %>% filter(SET == "set_4")

g <- ggplot(df_GRAPH, aes(x = YEAR,
                          y = VALUE,
                          fill = Level,)) +
        geom_bar(stat="Identity", width=0.65) +
        facet_grid(. ~ SCE) +
        labs(title = x, subtitle = "Set_4") +
        xlab("") +
        ylab("") +
        scale_x_discrete() + 
        scale_y_continuous() +
        scale_fill_manual(values = C6) +
        theme_light() +
        theme(axis.text.x = element_text(angle=45, vjust = 0),
              plot.title = element_text(hjust = 0.5, vjust = 0.5), 
              plot.subtitle = element_text(hjust = 0.5, vjust = 0.5))
  
gp <- ggplotly(g) %>% 
        layout(legend = list(orientation = "h", y = 0, x = 0.35))
gp

```

Fleet from Population by Car Availability
=======================================================================

Row {.tabset .tabset-fade}
-----------------------------------------------------------------------

### Reference - Full View

```{r Population_Full_View_Ref}

x <- "Base_Population_Cars_Fleet"

df_GRAPH = df_SCE %>% filter(VARIABLE == x) %>% group_by(SET)

g <- ggplot(df_GRAPH, aes(x = YEAR,
                          y = VALUE,
                          fill = CarAvail,)) +
        geom_bar(stat="Identity", width=0.65) +
        facet_grid(SCE ~ SET) +
        labs(title = x, subtitle = "") +
        xlab("") +
        ylab("") +
        scale_x_discrete() + 
        scale_y_continuous() +
  scale_fill_manual(values = C4) +
  theme_light() +
  theme(axis.text.x = element_text(angle=45, vjust = 0),
        plot.title = element_text(hjust = 0.5, vjust = 0.5), 
        plot.subtitle = element_text(hjust = 0.5, vjust = 0.5))

gp <- ggplotly(g) %>% 
        layout(legend = list(orientation = "h", y = 0, x = 0.35))
gp

```

### Reference - Scenario 1

```{r Population_Ref_SCE_1}

SCE_x = "SCE_1"

df_GRAPH = df_SCE %>% filter(VARIABLE == x, ) %>% filter(SCE == SCE_x)

g <- ggplot(df_GRAPH, aes(x = YEAR,
                          y = VALUE,
                          fill = CarAvail,)) +
        geom_bar(stat="Identity", width=0.65) +
        facet_grid(. ~ SET) +
        labs(title = x, subtitle = SCE_x) +
        xlab("") +
        ylab("") +
        scale_x_discrete() + 
        scale_y_continuous() +
  scale_fill_manual(values = C4) +
  theme_light() +
  theme(axis.text.x = element_text(angle=45, vjust = 0),
        plot.title = element_text(hjust = 0.5, vjust = 0.5), 
        plot.subtitle = element_text(hjust = 0.5, vjust = 0.5))

  
gp <- ggplotly(g) %>% 
        layout(legend = list(orientation = "h", y = 0, x = 0.35))
gp

```

### Reference - Scenario 2

```{r Population_Ref_SCE_2}

SCE_x = "SCE_2"

df_GRAPH = df_SCE %>% filter(VARIABLE == x, ) %>% filter(SCE == SCE_x)

g <- ggplot(df_GRAPH, aes(x = YEAR,
                          y = VALUE,
                          fill = CarAvail,)) +
        geom_bar(stat="Identity", width=0.65) +
        facet_grid(. ~ SET) +
        labs(title = x, subtitle = SCE_x) +
        xlab("") +
        ylab("") +
        scale_x_discrete() + 
        scale_y_continuous() +
  scale_fill_manual(values = C4) +
  theme_light() +
  theme(axis.text.x = element_text(angle=45, vjust = 0),
        plot.title = element_text(hjust = 0.5, vjust = 0.5), 
        plot.subtitle = element_text(hjust = 0.5, vjust = 0.5))

  
gp <- ggplotly(g) %>% 
        layout(legend = list(orientation = "h", y = 0, x = 0.35))
gp

```

### Reference - Scenario 3

```{r Population_Ref_SCE_3}

SCE_x = "SCE_3"

df_GRAPH = df_SCE %>% filter(VARIABLE == x, ) %>% filter(SCE == SCE_x)

g <- ggplot(df_GRAPH, aes(x = YEAR,
                          y = VALUE,
                          fill = CarAvail,)) +
        geom_bar(stat="Identity", width=0.65) +
        facet_grid(. ~ SET) +
        labs(title = x, subtitle = SCE_x) +
        xlab("") +
        ylab("") +
        scale_x_discrete() + 
        scale_y_continuous() +
  scale_fill_manual(values = C4) +
  theme_light() +
  theme(axis.text.x = element_text(angle=45, vjust = 0),
        plot.title = element_text(hjust = 0.5, vjust = 0.5), 
        plot.subtitle = element_text(hjust = 0.5, vjust = 0.5))

  
gp <- ggplotly(g) %>% 
        layout(legend = list(orientation = "h", y = 0, x = 0.35))
gp

```

### Reference - Scenario 4

```{r Population_Ref_SCE_4}

SCE_x = "SCE_4"

df_GRAPH = df_SCE %>% filter(VARIABLE == x, ) %>% filter(SCE == SCE_x)

g <- ggplot(df_GRAPH, aes(x = YEAR,
                          y = VALUE,
                          fill = CarAvail,)) +
        geom_bar(stat="Identity", width=0.65) +
        facet_grid(. ~ SET) +
        labs(title = x, subtitle = SCE_x) +
        xlab("") +
        ylab("") +
        scale_x_discrete() + 
        scale_y_continuous() +
  scale_fill_manual(values = C4) +
  theme_light() +
  theme(axis.text.x = element_text(angle=45, vjust = 0),
        plot.title = element_text(hjust = 0.5, vjust = 0.5), 
        plot.subtitle = element_text(hjust = 0.5, vjust = 0.5))

  
gp <- ggplotly(g) %>% 
        layout(legend = list(orientation = "h", y = 0, x = 0.35))
gp

```

### Reference - SET 4 Sample

```{r Population Reference_set_4}

x <- "Base_Population_Cars_Fleet"

df_GRAPH = df_SCE %>% filter(VARIABLE == x, ) %>% filter(SET == "set_4")

g <- ggplot(df_GRAPH, aes(x = YEAR,
                          y = VALUE,
                          fill = CarAvail,)) +
  geom_bar(stat="Identity", width=0.65) +
  facet_grid(. ~ SCE) +
  labs(title = x, subtitle = "Set_4") +
  xlab("") +
  ylab("") +
  scale_x_discrete() + 
  scale_y_continuous() +
  scale_fill_manual(values = C4) +
  theme_light() +
  theme(axis.text.x = element_text(angle=45, vjust = 0),
        plot.title = element_text(hjust = 0.5, vjust = 0.5), 
        plot.subtitle = element_text(hjust = 0.5, vjust = 0.5))
  
gp <- ggplotly(g) %>% 
        layout(legend = list(orientation = "h", y = 0, x = 0.35))
gp

```

Row {.tabset .tabset-fade}
-----------------------------------------------------------------------

### Scenario - Full View

```{r Population_Full_view_SCE}
x <- "Population_Cars_Fleet"

df_GRAPH = df_SCE %>% filter(VARIABLE == x) %>% group_by(SET)

g <- ggplot(df_GRAPH, aes(x = YEAR,
                          y = VALUE,
                          fill = CarAvail,)) +
        geom_bar(stat="Identity", width=0.65) +
        facet_grid(SCE ~ SET) +
        labs(title = x, subtitle = "") +
        xlab("") +
        ylab("") +
        scale_x_discrete() + 
        scale_y_continuous() +
  scale_fill_manual(values = C4) +
  theme_light() +
  theme(axis.text.x = element_text(angle=45, vjust = 0),
        plot.title = element_text(hjust = 0.5, vjust = 0.5), 
        plot.subtitle = element_text(hjust = 0.5, vjust = 0.5))

gp <- ggplotly(g) %>% 
        layout(legend = list(orientation = "h", y = 0, x = 0.35))
gp

```

### Scenario - Scenario 1

```{r Population SCE_1}

SCE_x = "SCE_1"

df_GRAPH = df_SCE %>% filter(VARIABLE == x, ) %>% filter(SCE == SCE_x)

g <- ggplot(df_GRAPH, aes(x = YEAR,
                          y = VALUE,
                          fill = CarAvail,)) +
  geom_bar(stat="Identity", width=0.65) +
        facet_grid(. ~ SET) +
        labs(title = x, subtitle = SCE_x) +
        xlab("") +
        ylab("") +
        scale_x_discrete() + 
        scale_y_continuous() +
  scale_fill_manual(values = C4) +
  theme_light() +
  theme(axis.text.x = element_text(angle=45, vjust = 0),
        plot.title = element_text(hjust = 0.5, vjust = 0.5), 
        plot.subtitle = element_text(hjust = 0.5, vjust = 0.5))

  
gp <- ggplotly(g) %>% 
        layout(legend = list(orientation = "h", y = 0, x = 0.35))
gp

```

### Scenario - Scenario 2

```{r Population SCE_2}

SCE_x = "SCE_2"

df_GRAPH = df_SCE %>% filter(VARIABLE == x, ) %>% filter(SCE == SCE_x)

g <- ggplot(df_GRAPH, aes(x = YEAR,
                          y = VALUE,
                          fill = CarAvail,)) +
  geom_bar(stat="Identity", width=0.65) +
        facet_grid(. ~ SET) +
        labs(title = x, subtitle = SCE_x) +
        xlab("") +
        ylab("") +
        scale_x_discrete() + 
        scale_y_continuous() +
  scale_fill_manual(values = C4) +
  theme_light() +
  theme(axis.text.x = element_text(angle=45, vjust = 0),
        plot.title = element_text(hjust = 0.5, vjust = 0.5), 
        plot.subtitle = element_text(hjust = 0.5, vjust = 0.5))

  
gp <- ggplotly(g) %>% 
        layout(legend = list(orientation = "h", y = 0, x = 0.35))
gp

```

### Scenario - Scenario 3

```{r Population SCE_3}

SCE_x = "SCE_3"

df_GRAPH = df_SCE %>% filter(VARIABLE == x, ) %>% filter(SCE == SCE_x)

g <- ggplot(df_GRAPH, aes(x = YEAR,
                          y = VALUE,
                          fill = CarAvail,)) +
  geom_bar(stat="Identity", width=0.65) +
        facet_grid(. ~ SET) +
        labs(title = x, subtitle = SCE_x) +
        xlab("") +
        ylab("") +
        scale_x_discrete() + 
        scale_y_continuous() +
  scale_fill_manual(values = C4) +
  theme_light() +
  theme(axis.text.x = element_text(angle=45, vjust = 0),
        plot.title = element_text(hjust = 0.5, vjust = 0.5), 
        plot.subtitle = element_text(hjust = 0.5, vjust = 0.5))

  
gp <- ggplotly(g) %>% 
        layout(legend = list(orientation = "h", y = 0, x = 0.35))
gp

```

### Scenario - Scenario 4

```{r Population SCE_4}

SCE_x = "SCE_4"

df_GRAPH = df_SCE %>% filter(VARIABLE == x, ) %>% filter(SCE == SCE_x)

g <- ggplot(df_GRAPH, aes(x = YEAR,
                          y = VALUE,
                          fill = CarAvail,)) +
  geom_bar(stat="Identity", width=0.65) +
        facet_grid(. ~ SET) +
        labs(title = x, subtitle = SCE_x) +
        xlab("") +
        ylab("") +
        scale_x_discrete() + 
        scale_y_continuous() +
  scale_fill_manual(values = C4) +
  theme_light() +
  theme(axis.text.x = element_text(angle=45, vjust = 0),
        plot.title = element_text(hjust = 0.5, vjust = 0.5), 
        plot.subtitle = element_text(hjust = 0.5, vjust = 0.5))

  
gp <- ggplotly(g) %>% 
        layout(legend = list(orientation = "h", y = 0, x = 0.35))
gp

```

### Scenario - SET 4 Sample

```{r Population SCE_set_4}

df_GRAPH = df_SCE %>% filter(VARIABLE == x, ) %>% filter(SET == "set_4")

g <- ggplot(df_GRAPH, aes(x = YEAR,
                          y = VALUE,
                          fill = CarAvail,)) +
  geom_bar(stat="Identity", width=0.65) +
  facet_grid(. ~ SCE) +
  labs(title = x, subtitle = "Set_4") +
  xlab("") +
  ylab("") +
  scale_x_discrete() + 
  scale_y_continuous() +
  scale_fill_manual(values = C4) +
  theme_light() +
  theme(axis.text.x = element_text(angle=45, vjust = 0),
        plot.title = element_text(hjust = 0.5, vjust = 0.5), 
        plot.subtitle = element_text(hjust = 0.5, vjust = 0.5))
  
gp <- ggplotly(g) %>% 
        layout(legend = list(orientation = "h", y = 0, x = 0.35))
gp

```