| tinyplot.ts | R Documentation |
Convenience interface for visualizing ts
(time series) objects with tinyplot.
## S3 method for class 'ts'
tinyplot(
x,
facet,
type = "l",
facet.args = list(free = TRUE),
xlab = NULL,
ylab = NA,
...
)
x |
an object of class |
facet |
specification of |
type, facet.args, xlab, ylab, ... |
further arguments passed to |
Internally the time series object is converted to a long
data frame with columns Time (time index), Value (observations),
and Series (factor with column labels). Depending on the settings
of facet this data frame is visualized either with the formula
Value ~ Time or Value ~ Time | Series. See the facet argument
description for more details and the Examples below for some illustrations.
An exception is made if the user explicitly supplies a distribution type
argument (i.e, one of "histogram", "density", "boxplot", "violin",
"qq", "ridge", or "rug"). These summarize the series values and
ignore the time index, so they are visualized with the one-sided
formula ~ Value (or ~ Value | Series for multivariate series). This
preserves base-R-compatible behaviour such as
tinyplot(Nile, type = "histogram").
By default, no return value; called for the side effect of producing
a plot. If record = TRUE (or globally via tpar(record = TRUE)), the
plot is instead returned invisibly as a "recordedtinyplot" object, which
can be replayed later; see recordedtinyplot.
## 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.