#' Plot temporal evolution of variable by PFT
#'
#' @param f path to a LPJ-GUESS output file
#' @import readr
#' @import ggplot2
#' @import dplyr
#' @import tidyr
#' @export
evoplot <- function(f) {
dat <- read_table(f)
datt <- dat %>% gather(PFT, Value, BNE:C4G)
datt %>% group_by(Year, PFT) %>%
summarise(mean_value = mean(Value)) %>%
group_by(PFT) %>%
filter(sum(mean_value) != 0) -> datt
ggplot(datt, aes(x = Year, y = mean_value)) +
geom_area(aes(fill = PFT))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.