I have the following dataframe:
df <- data.frame(
time = factor(c(1, 1, 2, 2)),
value = c(1, 5, 3, 4),
group = factor(c(1, 2, 1, 2)),
upper = c(1.1, 5.3, 3.3, 4.2),
lower = c(0.8, 4.6, 2.4, 3.6)
)
I want to plot the column "value" as a line and then an area that goes "under" which minimum point is lower and maximum point is upper.
So far I have this:
ggplot(df, aes(time, value, colour = group)) +
geom_line(aes(group = group)) +
geom_errorbar(aes(ymin = lower, ymax = upper), width = 0.2)