Consider the graph below that I created with the code further below. I would like to add a legend that might say something like "median" and "90% confidence interval." I've seen this question partially addressed here (thanks Roland), but when I try to implement it in my own code, the legend looks silly because the middle line doesn't have a fill while the ribbon does. Is there some way to get the legend to look sensible, where it shows just a line for the middle line and a fill box for the ribbon?
library(ggplot2)
middle = data.frame(t=c(0,1,2,3),value=c(0,2,4,6))
ribbon = data.frame(t=c(0,1,2,3),min=c(0,0,0,0),max=c(0,4,8,12))
g = ggplot()
g = g + geom_line (data=middle,aes(x=t,y=value),color='blue',size=2)
g = g + geom_ribbon(data=ribbon,aes(x=t,ymin=min,ymax=max),alpha=.3,fill='lightblue')
print(g)
library(ggplot2)
middle = data.frame(t=c(0,1,2,3),value=c(0,2,4,6))
ribbon = data.frame(t=c(0,1,2,3),min=c(0,0,0,0),max=c(0,4,8,12))
g = ggplot()
g = g + geom_ribbon(data=ribbon,aes(x=t,ymin=min,ymax=max,fill="CI" ,color="CI"))
g = g + geom_line (data=middle,aes(x=t,y=value, color="median"))
g = g + scale_colour_manual(values=c("lightblue","blue"))
g = g + scale_fill_manual (values=c("lightblue"))
print(g)