Skip to content
Snippets Groups Projects
plotly_ts.R 2.12 KiB
Newer Older
  • Learn to ignore specific revisions
  • pbac's avatar
    pbac committed
    ## Do this in a separate file to see the generated help:
    #library(devtools)
    #document()
    #load_all(as.package("../../onlineforecast"))
    #?plotly_ts
    #?plotly_ts.data.frame
    
    #' Plot time series of observations and predictions, with correct lagging for onlineforecast type of data structures.
    #'
    #' Simply the same as \code{\link{plot_ts}()} with \code{usely=TRUE}, such that plotly is used.
    #'
    
    pbac's avatar
    pbac committed
    #' The \code{plotly} package must be installed and loaded.
    
    pbac's avatar
    pbac committed
    #'
    #' Note that the plot parameters set with \code{\link{par_ts}()} have no effect on the \code{plotly} plots.
    #'
    
    pbac's avatar
    pbac committed
    #' See \url{https://onlineforecasting.org/vignettes/nice-tricks.html}.
    
    pbac's avatar
    pbac committed
    #' 
    
    pbac's avatar
    pbac committed
    #' @examples
    #'
    
    pbac's avatar
    pbac committed
    #' # See the website link above
    #' 
    
    pbac's avatar
    pbac committed
    #' @export
    
    plotly_ts <- function(object, patterns=".*", xlim = NA, ylims = NA, xlab = "", ylabs = NA,
    
                        mains = "", mainouter="", legendtexts = NA, colormaps = NA, xat = NA, usely = FALSE, p = NA, ...){
    
    pbac's avatar
    pbac committed
        UseMethod("plotly_ts")
    }
    
    #' @export
    plotly_ts.data.list <- function(object, patterns=".*", xlim = NA, ylims = NA, xlab = "", ylabs = NA,
    
                                  mains = "", mainouter="", legendtexts = NA, colormaps = NA, xat = NA, usely=TRUE, p=NA, kseq = NA, ...) {
    
    pbac's avatar
    pbac committed
        plot_ts.data.list(object=object, patterns=patterns, xlim = xlim, ylims = ylims, xlab = xlab, ylabs = ylabs,
    
                          mains = mains, mainouter=mainouter, legendtexts = legendtexts, colormaps = colormaps, xat = xat, usely = usely, p = p, kseq=kseq, ...)
    
    pbac's avatar
    pbac committed
    }
    
    #' @export
    plotly_ts.data.frame <- function(object, patterns=".*", xlim = NA, ylims = NA, xlab = "", ylabs = NA,
    
                                  mains = "", mainouter="", legendtexts = NA, colormaps = NA, xat = NA, usely=TRUE, p=NA, namesdata=NA, ...) {
    
    pbac's avatar
    pbac committed
        plot_ts.data.frame(object=object, patterns=patterns, xlim = xlim, ylims = ylims, xlab = xlab, ylabs = ylabs,
    
                          mains = mains, mainouter=mainouter, legendtexts = legendtexts, colormaps = colormaps, xat = xat, usely = usely, p = p, namesdata=namesdata, ...)
    
    pbac's avatar
    pbac committed
    }
    
    ## plotly_ts.rls_fit <- function(fit, xlim=NA, kseq=NA, plotit=TRUE){
    ##     plotly_ts.rls_fit(fit, xlim=xlim, kseq=kseq, plotit=plotit, usely=TRUE)
    ## }