Commit 28bac642 authored by Matteo DE FELICE's avatar Matteo DE FELICE

Added demand line to generation mix plot

parent 04fc0e6e
......@@ -18,6 +18,11 @@ shinyServer(function(input, output, session) {
mutate(date = seq(as_datetime('2016-01-01'), by = 'day', length.out = n()))
# Load ENTSOE Data
entsoe_storage = read_rds('data/ENTSOE-Storage-2015-2018.rds')
# Load WAPP demand data
wapp_demand = bind_rows(read_csv('data/demand.csv'),
read_csv('data/demand.csv'),
read_csv('data/demand.csv')) %>%
mutate(date = seq(as_datetime('2016-01-01'), by = 'day', length.out = n()))
# Average water value ---------------------------------------------------------------------
if (input$plot_type == 'awv') {
sel <-
......@@ -62,6 +67,14 @@ shinyServer(function(input, output, session) {
sel_zone = select(gen, date, contains(paste0(input$zone, '_')))
print(names(sel_zone))
if (input$zone %in% names(wapp_demand)) {
demand_df = tibble(date = wapp_demand$date,
demand = wapp_demand[[input$zone]])
} else {
demand_df = NULL
}
color_palette = c('HPHS' = 'blue4',
'HDAM' = 'blue3',
'HROR' = 'cornflowerblue',
......@@ -89,11 +102,16 @@ shinyServer(function(input, output, session) {
mutate(variance = sd(generation)/mean(generation)) %>%
ungroup() %>%
mutate(source_type = fct_reorder(source_type, -variance)) %>%
ggplot(aes(x = date, y = generation, group = source_type,
fill = source_type)) +
ggplot(aes(x = date, y = generation)) +
scale_fill_manual(values = color_palette) +
geom_area() +
geom_area(aes(group = source_type,
fill = source_type)) +
theme_light()
if (!is.null(demand_df)) {
g = g + geom_line(data = demand_df,
aes(x = date, y = demand), color = 'black')
}
print(g)
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment