17

I created the forecasting plot with the point forecast and confidence interval. However, i only want the point forecast(blue line) without the confidence interval(the grey background). How do i do that? Below is my current code and the screenshot of my plot.

  plot(snv.data$mean,main="Forecast for monthly Turnover in Food   
  Retailing",xlab="Years",ylab="$ million",+ geom_smooth(se=FALSE))

M--
  • 25,431
  • 8
  • 61
  • 93
Lê Đạt
  • 171
  • 1
  • 1
  • 3
  • Welcome to Stack Overflow! Please read the info about [how to ask a good question](http://stackoverflow.com/help/how-to-ask) and how to give a [reproducible example](http://stackoverflow.com/questions/5963269). This will make it much easier for others to help you. – zx8754 Mar 20 '17 at 07:14

1 Answers1

22

Currently it seems to me that you try a mixture between the base function plot and the ggplot2 function geom_smooth. I don't think it is a very good idea in this case.

Since you want to use geom_smooth why not try to do it all with `ggplot2'?

Here is how you would do it with ggplot2 ( I used R-included airmiles data as example data)

library(ggplot2)
data = data.frame("Years"=seq(1937,1960,1),"Miles"=airmiles) #Creating a sample dataset

ggplot(data,aes(x=Years,y=Miles))+ 
        geom_point()+ 
        geom_smooth(se=F) 

With ggplot you can set options like your x and y variables once and for all in the aes() of your ggplot() call, which is the reason why I didnt need any aes() call for geom_point().

Then I add the smoother function geom_smooth(), with option se=F to remove the confidence interval

Tim17
  • 321
  • 1
  • 2