Skip to content

Commit

Permalink
Add scenario to plot
Browse files Browse the repository at this point in the history
  • Loading branch information
stephpenn1 committed Dec 8, 2023
1 parent 95a36a5 commit 1e8a483
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
5 changes: 2 additions & 3 deletions h2/components/functions/func_graph_plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 1 addition & 5 deletions h2/components/modules/mod_run.R
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -45,7 +42,6 @@ run_ui <- function(id) {
dataTableOutput(ns("savetable")),
actionButton(ns("deleteRuns"), "Delete Selected")
)
# )
)
)

Expand Down Expand Up @@ -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) {

Expand Down

0 comments on commit 1e8a483

Please sign in to comment.