Plots historical data with forecasts and prediction intervals.
## S3 method for class 'forecast': plot(x, include, plot.conf=TRUE, shaded=TRUE, shadebars=(length(x$mean)<5), shadecols="NULL," col="1," fcol="4," pi.col="1," pi.lty="2," ylim="NULL," main="NULL," ylab="" ,="" xlab="" type="l" flty="1," flwd="2," ...)<="" p="">
## S3 method for class 'splineforecast': plot(x, fitcol=2, type="o", pch=19, ...)5),>
- Forecast object produced by
- number of values from time series to include in plot
- Logical flag indicating whether to plot prediction intervals.
- Logical flag indicating whether prediction intervals should be shaded (TRUE) or lines (FALSE)
- Logical flag indicating if prediction intervals should be plotted as shaded bars (if TRUE) or a shaded polygon (if FALSE).
shaded=FALSE. Bars are plotted by default if there are fewer than five forecast horizons.
- Colors for shaded prediction intervals. To get default colors used prior to v3.26, set
- Colour for the data line.
- Colour for the forecast line.
- Line type for the forecast line.
- Line width for the forecast line.
plot.conf=TRUE, the prediction intervals are plotted in this colour.
plot.conf=TRUE, the prediction intervals are plotted using this line type.
- Limits on y-axis
- Main title
- Y-axis label
- X-axis label
- Line colour for fitted values.
- 1-character string giving the type of plot desired. As for
- Plotting character (if
- additional arguments to
Hyndman and Athanasopoulos (2012) Forecasting: principles and practice, OTexts: Melbourne, Australia.
deaths.fit <- hw(USAccDeaths,h=48) plot(deaths.fit)