diff --git a/howTo/openGeogAPI/app.R b/howTo/openGeogAPI/app.R index 44f359ed09540e78d043c6ebca5525fd3ee1171f..1440176a1588dfe2d34f4d0654fa37b508b334f2 100644 --- a/howTo/openGeogAPI/app.R +++ b/howTo/openGeogAPI/app.R @@ -170,9 +170,15 @@ server <- function(input, output, session) { "\nLocal authority boundary data (2018): ONS Open Geography Portal", "\nVisualisation: rushby.shinyapps.io/LAemissions") - plotTitle = paste0("Greenhouse gas emissions by sector for ",input$authmap_shape_click$id) + if(is.null(input$authmap_shape_click$id)){ + auth_area <- "Southampton" + } else { + auth_area <- input$authmap_shape_click$id + } + + plotTitle = paste0("Greenhouse gas emissions by sector for ",auth_area) - ggplot(ghg_subset(auth_area = input$authmap_shape_click$id), aes(x = Year, y = value)) + + ggplot(ghg_subset(auth_area = auth_area), aes(x = Year, y = value)) + geom_col(aes(fill = variable), position = "stack") + scale_x_continuous(limits = c(x_min-1,x_max+1), breaks = x_min:x_max) + #scale_y_continuous(limits = c(y_min,y_max)) +