Sample data:
DF <- data.frame("TIME"=c(1:10),
"COEF1"=c(0.15,0.93,0.80,0.59,0.89,0.18,0.95,0.90,0.75,0.61),
"COEF1LOWER"=c(0.05,0.83,0.70,0.49,0.79,0.08,0.85,0.80,0.65,0.51),
"COEF1UPPER"=c(0.25,1.03,0.90,0.69,0.99,0.28,1.05,1.00,0.85,0.71),
"COEF2"=c(0.21,0.29,0.95,0.80,0.34,0.10,0.40,0.47,0.54,0.67),
"COEF2LOWER"=c(0.11,0.19,0.85,0.70,0.24,0.00,0.30,0.37,0.44,0.57),
"COEF2UPPER"=c(0.31,0.39,1.05,0.90,0.44,0.20,0.50,0.57,0.64,0.77),
"COEF3"=c(0.44,0.44,0.40,0.62,0.24,0.05,0.75,0.03,0.42,0.21),
"COEF3LOWER"=c(0.34,0.34,0.30,0.52,0.14,-0.05,0.65,-0.07,0.32,0.11),
"COEF3UPPER"=c(0.54,0.54,0.50,0.72,0.34,0.15,0.85,0.13,0.52,0.31))
My goal is to make a plot using ggplot() and this is the starting data I have. I have made plots before with a long data file but am not sure how to do this with the wide file. I want to plot COEF1, COEF2, COEF3 in different colors with their confidence limits.
p <- ggplot(DF, aes(x=time, y=COEF, ymin=LOWER, ymax=UPPER)) +
geom_ribbon(aes(fill=COEF_N), alpha=0.3) +
geom_line(aes(color=COEF_N))
print(p)
