#' @export
#' @title plot forecasts
#' @param x an S3 object of the class fcbvar as generated by the forecast function
#' @param ... currently not used
plot.fcbvar <- function(x,...){
cnames <- colnames(x$forecast)
nDim <- ncol(x$forecast)
nLength <- floor(sqrt(nDim))
if(is.ts(x$forecast)){
tsStart = start(x$forecast)
tsFrequency = frequency(x$forecast)
}
pltList <- list()
for(ii in 1:nDim){
tempDf <- data.frame(Upper = x$Upper[,ii],forecast = x$forecast[,ii],Lower = x$Lower[,ii],Original=x$Original[,ii])
if(is.ts(x$forecast)){
tempts <- ts(tempDf,start=tsStart,frequency=tsFrequency)
}
else{
tempts <- ts(tempDf,start=c(1))
}
p1 <- autoplot(tempts, facets=FALSE) +
ggplot2::theme(legend.position = "none") +
ggplot2::labs(title=cnames[ii])
#p1
#readline("Press [Enter] to continue")
pltList[[ii]] <- p1
}
suppressWarnings(do.call("grid.arrange",c(pltList,ncol=nLength)))
}
#' @export
#' @title plot forecasts
#' @param x an S3 object of the class fcbvar as generated by the forecast function
#' @param ... currently not used
plot.fctvar <- function(x,...){
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.