% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tinyplot.ts.R
\name{tinyplot.ts}
\alias{tinyplot.ts}
\title{tinyplot Method for Plotting ts Objects (Time Series)}
\usage{
\method{tinyplot}{ts}(
  x,
  facet,
  type = "l",
  facet.args = list(free = TRUE),
  xlab = NULL,
  ylab = NA,
  ...
)
}
\arguments{
\item{x}{an object of class \code{"ts"}.}

\item{facet}{specification of \code{facet} for \code{tinyplot.formula}. The
default in the \code{tinyplot} method is to use \code{facet = NULL} for univariate
series and \code{facet = ~ Series} (equivalent to \code{facet = "by"}) for
multivariate series.}

\item{type, facet.args, xlab, ylab, ...}{further arguments passed to \code{tinyplot}.}
}
\value{
No return value, called for the side effect of producing a plot.
}
\description{
Convenience interface for visualizing \code{\link[stats]{ts}}
(time series) objects with tinyplot.
}
\details{
Internally the time series object is converted to a long
data frame with columns \code{Time} (time index), \code{Value} (observations),
and \code{Series} (factor with column labels). Depending on the settings
of \code{facet} this data frame is visualized either with the formula
\code{Value ~ Time} or \code{Value ~ Time | Series}. See the \code{facet} argument
description for more details and the Examples below for some illustrations.

An exception is made if the user explicitly supplies a distribution \code{type}
argument (i.e, one of \code{"histogram"}, \code{"density"}, \code{"boxplot"}, \code{"violin"},
\code{"qq"}, \code{"ridge"}, or \code{"rug"}). These summarize the series values and
ignore the time index, so they are visualized with the one-sided
formula \code{~ Value} (or \code{~ Value | Series} for multivariate series). This
preserves base-R-compatible behaviour such as
\code{tinyplot(Nile, type = "histogram")}.
}
\examples{
## univariate series
tinyplot(Nile)

# exception: expicitly passing a distribution type on a univariate series
# still triggers the corresponding transformation
tinyplot(Nile, type = "histogram")

## multivariate series (generally, these also look better with a theme)
tinytheme("clean2")
tinyplot(EuStockMarkets)                    ## faceted, free scales, same color
tinyplot(EuStockMarkets, facet.args = NULL) ## faceted, same scale, same color
tinyplot(EuStockMarkets, facet = "by")      ## faceted, free scales, diff colors
tinyplot(EuStockMarkets, facet = NULL)      ## single frame, diff colors

## further variations
tinyplot(EuStockMarkets, facet = NULL, legend = list("direct", repel = TRUE))
tinyplot(EuStockMarkets, facet = "by", facet.args = NULL)
tinyplot(EuStockMarkets, facet.args = list(free = TRUE, ncol = 1))

## pass additional tinyplot args through `...` for further customization
tinyplot(EuStockMarkets,
         facet.args = NULL,
         type = "area", xlab = NA, yaxl = ",",
         main = "European stock indices")

tinytheme() ## reset

}
