knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  eval = FALSE
)
library(mapselector)
library(tidyverse)

subset_our <- function(dd, reg){
  subset(dd, dd$region == reg)
}

plot_ouranos_one_region <- function(reg){
  project_plot <- subset_our(mapselector::ouranos_rcp, reg) %>%
    ggplot(aes(x = Annee, y = Avg, colour = rcp, fill = rcp,  ymin = Min, ymax = Max)) + 
    geom_line() + facet_wrap(~var, scales = "free") + geom_ribbon(alpha = 0.1)

  project_plot + 
    geom_line(aes(x = Annee, y = Obs),inherit.aes = FALSE, 
              data = subset_our(mapselector::ouranos_observed, reg))
}

plot_ouranos_one_region("Abitibi-Témiscamingue")


ReseauBiodiversiteQuebec/mapselector documentation built on Feb. 22, 2022, 3:13 p.m.