From 1e8a483a6b47a27480f718b011c147f1848aabbd Mon Sep 17 00:00:00 2001 From: Stephanie Pennington Date: Fri, 8 Dec 2023 16:45:15 -0500 Subject: [PATCH] Add scenario to plot --- h2/components/functions/func_graph_plots.R | 5 ++--- h2/components/modules/mod_run.R | 6 +----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/h2/components/functions/func_graph_plots.R b/h2/components/functions/func_graph_plots.R index 6bc2516..4a5c104 100644 --- a/h2/components/functions/func_graph_plots.R +++ b/h2/components/functions/func_graph_plots.R @@ -8,17 +8,16 @@ graph_plots <- function(r6) { {ggplot(r6$no_save_output) + geom_line(aes(x = year, y = value, color = ssp)) + labs(x = "Year", y = last(r6$output)$variable[1], - title = paste0("Run Name: ", last(r6$output)$run[1], "\n",last(r6$output)$variable[1])) + + title = paste0("Run Name: ", last(r6$output)$run[1], "\n", "Variable: ", last(r6$output)$variable[1])) + theme(legend.position = "bottom")} %>% plotly::ggplotly() } else if(r6$save == FALSE) { - browser() {ggplot(r6$no_save_output) + geom_line(aes(x = year, y = value, color = ssp)) + labs(x = "Year", y = r6$no_save_output$variable[1], - title = paste0("Run Name: Unsaved Run\n", r6$no_save_output$variable[1]))} %>% + title = paste0("Run Name: Unsaved Run\n", "Variable: ", r6$no_save_output$variable[1]))} %>% plotly::ggplotly() %>% layout( legend = list( diff --git a/h2/components/modules/mod_run.R b/h2/components/modules/mod_run.R index 5a431d2..6c768b9 100644 --- a/h2/components/modules/mod_run.R +++ b/h2/components/modules/mod_run.R @@ -6,10 +6,7 @@ run_ui <- function(id) { sidebarPanel( tabsetPanel( tabPanel(class = "params", "Standard Scenarios", - h5("Shared Socioeconomic Pathways (SSPs)"), - # tagList( chooseSliderSkin(skin = "Flat", color = "#375a7f"), - #textInput(ns("core_name"), "Input name for core:", placeholder="Unnamed Hector core"), prettyRadioButtons(ns("ssp_path"), label="Select SSP:", choices = list("SSP 1-1.9"="input/hector_ssp119.ini", "SSP 1-2.6"="input/hector_ssp126.ini", @@ -45,7 +42,6 @@ run_ui <- function(id) { dataTableOutput(ns("savetable")), actionButton(ns("deleteRuns"), "Delete Selected") ) - # ) ) ) @@ -132,7 +128,7 @@ run_server <- function(id, r6) { if (r6$save == TRUE) { r6$output[[r6$run_name()]] <- fetchvars(core(), r6$time()[1]:r6$time()[2], vars = list(r6$selected_var())) %>% - mutate(run = r6$run_name(), ssp = input$ssp_path) + mutate(run = r6$run_name(), Scenario = input$ssp_path) } else if (r6$save == FALSE) {