0

I am making a time series plot with ggplot. I have the mean and the variance of the 5 variables of interest. I can plot the variance with error bars, but when I try to do it with geom_smooth()/stat_smooth() it doesn't work well.

   ggplot(data = df4, aes(x = times, y = value, colour = variable)) + geom_line()+
        geom_errorbar(aes(ymin = value-var, ymax = value+var))+
        geom_errorbarh(aes(xmin = value-var, xmax = value+var))+ geom_smooth()

Output figure

mountainlake
  • 39
  • 1
  • 4
  • 1
    Maybe you want `geom_ribbon` instead? Consider making your question [reproducible](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) by adding an small example dataset to go along with your code. – aosmith Mar 31 '16 at 18:41
  • It worked! Do you know how to I change the color of the shadow, so it will be as the color of the lines? – mountainlake Mar 31 '16 at 18:56
  • Use `fill` rather than `color`. `color` will only change the outline of 2d areas. – joran Apr 01 '16 at 02:41

0 Answers0