\name{PlotVslTime}
\alias{PlotVslTime}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
%%  ~~function to do ... ~~
}
\description{
%%  ~~ A concise (1-5 lines) description of what the function does. ~~
}
\usage{
PlotVslTime(var, toptitle = "", ytitle = "", monini = 1, freq = 12, nticks = NULL, limits = NULL, listexp = c("exp1", "exp2", "exp3"), listobs = c("obs1", "obs2", "obs3"), biglab = F, hlines = NULL, leg = T, siglev = F, fileout = "output_plotvsltime.eps", sizetit = 1)
}
%- maybe also 'usage' for other objects documented here.
\arguments{
  \item{var}{
%%     ~~Describe \code{var} here~~
}
  \item{toptitle}{
%%     ~~Describe \code{toptitle} here~~
}
  \item{ytitle}{
%%     ~~Describe \code{ytitle} here~~
}
  \item{monini}{
%%     ~~Describe \code{monini} here~~
}
  \item{freq}{
%%     ~~Describe \code{freq} here~~
}
  \item{nticks}{
%%     ~~Describe \code{nticks} here~~
}
  \item{limits}{
%%     ~~Describe \code{limits} here~~
}
  \item{listexp}{
%%     ~~Describe \code{listexp} here~~
}
  \item{listobs}{
%%     ~~Describe \code{listobs} here~~
}
  \item{biglab}{
%%     ~~Describe \code{biglab} here~~
}
  \item{hlines}{
%%     ~~Describe \code{hlines} here~~
}
  \item{leg}{
%%     ~~Describe \code{leg} here~~
}
  \item{siglev}{
%%     ~~Describe \code{siglev} here~~
}
  \item{fileout}{
%%     ~~Describe \code{fileout} here~~
}
  \item{sizetit}{
%%     ~~Describe \code{sizetit} here~~
}
}
\details{
%%  ~~ If necessary, more details than the description above ~~
}
\value{
%%  ~Describe the value returned
%%  If it is a LIST, use
%%  \item{comp1 }{Description of 'comp1'}
%%  \item{comp2 }{Description of 'comp2'}
%% ...
}
\references{
%% ~put references to the literature/web site here ~
}
\author{
%%  ~~who you are~~
}
\note{
%%  ~~further notes~~
}

%% ~Make other sections like Warning with \section{Warning }{....} ~

\seealso{
%% ~~objects to See Also as \code{\link{help}}, ~~~
}
\examples{
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (var, toptitle = "", ytitle = "", monini = 1, freq = 12, 
    nticks = NULL, limits = NULL, listexp = c("exp1", "exp2", 
        "exp3"), listobs = c("obs1", "obs2", "obs3"), biglab = F, 
    hlines = NULL, leg = T, siglev = F, fileout = "output_plotvsltime.eps", 
    sizetit = 1) 
{
    if (length(dim(var)) == 3) {
        var = insertdim(var, posdim = 2, lendim = 1)
    }
    nleadtime = dim(var)[4]
    nexp = dim(var)[1]
    nobs = dim(var)[2]
    if (is.null(limits) == T) {
        ll = min(var, na.rm = T)
        ul = max(var, na.rm = T)
        if (biglab) {
            ul = ul + 0.4 * (ul - ll)
        }
        else {
            ul = ul + 0.3 * (ul - ll)
        }
    }
    else {
        ll = limits[1]
        ul = limits[2]
    }
    lastyear = (monini + (nleadtime - 1) * 12/freq - 1)\%/\%12
    lastmonth = (monini + (nleadtime - 1) * 12/freq - 1)\%\%12 + 
        1
    empty_ts = ts(start = c(0, (monini - 1)\%/\%(12/freq) + 1), 
        end = c(lastyear, (lastmonth - 1)\%/\%(12/freq) + 1), frequency = freq)
    empty = array(dim = length(empty_ts))
    if (is.null(nticks)) {
        if (biglab) {
            nticks = 5
        }
        else {
            nticks = 10
        }
    }
    labind = seq(1, nleadtime, max(nleadtime\%/\%nticks, 1))
    months = c("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", 
        "Aug", "Sep", "Oct", "Nov", "Dec")
    labyear = ((labind - 1) * 12/freq + monini - 1)\%/\%12
    labmonth = months[((labind - 1) * 12/freq + monini - 1)\%\%12 + 
        1]
    for (jx in 1:length(labmonth)) {
        y2o3dig = paste("0", as.character(labyear[jx]), sep = "")
        labmonth[jx] = paste(labmonth[jx], "\nYr ", substr(y2o3dig, 
            nchar(y2o3dig) - 1, nchar(y2o3dig)), sep = "")
    }
    color = c("red1", "dodgerblue1", "green1", "orange1", "lightblue1", 
        "deeppink1", "mediumpurple1", "lightgoldenrod1", "olivedrab1", 
        "mediumorchid1")
    type = c(1, 3, 2, 4)
    thickness = array(dim = c(4, 4))
    thickness[, 1] = c(1, 2, 1, 1.5)
    thickness[, 2] = c(8, 12, 8, 10)
    thickness[, 3] = thickness[, 1]
    thickness[, 4] = c(4, 6, 4, 5)
    if (siglev == T) {
        lines = c("n", "l", "n", "l")
    }
    else {
        lines = c("l", "l", "l", "n")
    }
    postscript(fileout, width = 550, height = 300)
    if (biglab) {
        par(mai = c(1.25, 1.4, 0.5, 1), mgp = c(4, 2.5, 0))
        par(cex = 1.3, cex.lab = 2, cex.axis = 1.8)
        cexmain = 2.2
        legsize = 1.5
    }
    else {
        par(mai = c(1, 1.1, 0.5, 0), mgp = c(3, 1.8, 0))
        par(cex = 1.3, cex.lab = 1.5, cex.axis = 1.1)
        cexmain = 1.5
        legsize = 1
    }
    plot(empty, ylim = c(ll, ul), xlab = "Time (months)", ylab = ytitle, 
        main = toptitle, cex.main = cexmain * sizetit, axes = FALSE)
    axis(1, at = labind, labels = labmonth)
    axis(2)
    box()
    if (is.null(hlines) != T) {
        for (jy in 1:length(hlines)) {
            par(new = TRUE)
            abline(h = hlines[jy])
        }
    }
    legendnames = array(dim = nobs * nexp)
    legendthick = array(dim = nobs * nexp)
    legendsty = array(dim = nobs * nexp)
    legendcol = array(dim = nobs * nexp)
    ind = 1
    for (jt in seq(dim(var)[3], 1, -1)) {
        ind = 1
        for (jexp in 1:nexp) {
            for (jobs in 1:nobs) {
                par(new = TRUE)
                plot(var[jexp, jobs, jt, ], type = lines[jt], 
                  ylim = c(ll, ul), col = color[jexp], lty = type[jobs], 
                  lwd = thickness[jobs, jt], ylab = "", xlab = "", 
                  axes = FALSE)
                legendnames[ind] = paste(listexp[jexp], "vs", 
                  listobs[jobs])
                legendthick[ind] = thickness[jobs, 1] * 3
                legendsty[ind] = type[jobs]
                legendcol[ind] = color[jexp]
                ind = ind + 1
            }
        }
    }
    if (leg) {
        if (nobs == 1) {
            legendnames = listexp[1:nexp]
        }
        legend(1, ul, legendnames, lty = legendsty, lwd = legendthick, 
            col = legendcol, cex = legsize)
    }
    dev.off()
  }
}
% Add one or more standard keywords, see file 'KEYWORDS' in the
% R documentation directory.
\keyword{ ~kwd1 }
\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
