I want to plot a geom_area of Gi, function of datetime. I want that the fill of each the geom_area for each day is defined by the mean of Gi.
df %>% mutate(year = year(datetime)) %>%
filter(month(datetime) == 7) %>%
ggplot(aes(datetime, Gi, fill = mean(Gi), group = factor(year))) +
geom_area() + facet_wrap("year", scales = "free_x", ncol = 1)
Unfortunately, it's the result, the fill color doesn't vary by years :