Lê Đạt
Lê Đạt

Reputation: 191

Remove grey background confidence interval from forecasting plot

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))

Upvotes: 19

Views: 54249

Answers (1)

Tim17
Tim17

Reputation: 341

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

Upvotes: 24

Related Questions