Commit b69747f7 authored by Matteo DE FELICE's avatar Matteo DE FELICE

Now reservoir single exactly matches the name in the dropbox menu

parent 7586a002
......@@ -226,25 +226,25 @@ shinyServer(function(input, output, session) {
else if (input$plot_type == 'res_single') {
inflows = readxl::read_xlsx(paste0('', input$result_xls), sheet = 'Inflows') %>%
select(contains(input$hpp)) %>%
select((input$hpp)) %>%
mutate(date = seq(as_datetime('2016-01-01'), by = 'day', length.out = n())) %>%
mutate(day_of_the_year = yday(date)) %>%
gather(area, inflow, -date, -day_of_the_year)
spillage = readxl::read_xlsx(paste0('', input$result_xls), sheet = 'Spillage') %>%
select(contains(input$hpp)) %>%
select((input$hpp)) %>%
mutate(date = seq(as_datetime('2016-01-01'), by = 'day', length.out = n())) %>%
mutate(day_of_the_year = yday(date)) %>%
gather(area, spillage, -date, -day_of_the_year)
discharge = readxl::read_xlsx(paste0('', input$result_xls), sheet = 'Water discharge') %>%
select(contains(input$hpp)) %>%
select((input$hpp)) %>%
mutate(date = seq(as_datetime('2016-01-01'), by = 'day', length.out = n())) %>%
mutate(day_of_the_year = yday(date)) %>%
gather(area, discharge, -date, -day_of_the_year)
pumping = readxl::read_xlsx(paste0('', input$result_xls), sheet = 'Pumping') %>%
select(contains(input$hpp)) %>%
select((input$hpp)) %>%
mutate(date = seq(as_datetime('2016-01-01'), by = 'day', length.out = n())) %>%
mutate(day_of_the_year = yday(date)) %>%
gather(area, pumping, -date, -day_of_the_year)
......@@ -311,9 +311,32 @@ shinyServer(function(input, output, session) {
# ylab('GWh/day') +
theme(axis.text.x = element_text(size = 8, angle = 45, hjust = 1),
legend.position = 'bottom')
print(g)
# Hydro power generation ---------------------------------------------------------------------------------
} else if (input$plot_type == 'hydro_gen') {
hrgen_y = hrgen %>%
select(-X__1) %>%
gather(plant, generation, -date) %>%
mutate(year = lubridate::year(date)) %>%
group_by(year, plant) %>%
summarise(generation = sum(generation)) %>%
ungroup() %>%
separate(plant, c('Country', 'Type', 'Name'), remove = FALSE)
g = ggplot(hrgen_y, aes(x = fct_reorder(plant, generation, .desc = TRUE) ,
y = generation,
fill = Type)) +
geom_bar(stat = 'identity') +
geom_label(aes(label = round(generation)), color = 'white') +
facet_wrap(~year, ncol = 1) +
xlab('Hydro-power plant') +
theme_light() +
theme(axis.text.x = element_text(size = 12, angle = 90, hjust = 1))
print(g)
# Power flows ---------------------------------------------------------------------------------
} else if (input$plot_type == 'pf') {
}else if (input$plot_type == 'pf') {
this_pf = pf %>%
select(-X__1) %>%
......@@ -336,7 +359,7 @@ shinyServer(function(input, output, session) {
legend.position = 'none')
print(g)
}
}
})
})
\ No newline at end of file
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