autoplot.ts {ggfortify}R Documentation

Autoplot time-series-like

Description

Autoplot time-series-like

Usage

## S3 method for class 'ts'
autoplot(
  object,
  columns = NULL,
  group = NULL,
  is.date = NULL,
  index.name = "Index",
  p = NULL,
  ts.scale = FALSE,
  stacked = FALSE,
  facets = TRUE,
  nrow = NULL,
  ncol = 1,
  scales = "free_y",
  ts.geom = "line",
  ts.colour = NULL,
  ts.size = NULL,
  ts.linetype = NULL,
  ts.alpha = NULL,
  ts.fill = NULL,
  ts.shape = NULL,
  geom = ts.geom,
  colour = ts.colour,
  size = ts.size,
  linetype = ts.linetype,
  alpha = ts.alpha,
  fill = ts.fill,
  shape = ts.shape,
  xlim = c(NA, NA),
  ylim = c(NA, NA),
  log = "",
  main = NULL,
  xlab = "",
  ylab = "",
  asp = NULL,
  ...
)

Arguments

object

time-series-like instance

columns

Character vector specifies target column name(s)

group

Character vector specifies grouping

is.date

Logical frag indicates whether the stats::ts is date or not If not provided, regard the input as date when the frequency is 4 or 12

index.name

Specify column name for time series index when passing data.frame via data.

p

ggplot2::ggplot instance

ts.scale

Logical flag indicating whether to perform scaling each timeseries

stacked

Logical flag indicating whether to stack multivariate timeseries

facets

Logical value to specify use facets

nrow

Number of facet/subplot rows

ncol

Number of facet/subplot columns

scales

Scale value passed to ggplot2

ts.geom

geometric string for time-series. 'line', 'bar', 'ribbon', or 'point'

ts.colour

line colour for time-series

ts.size

point size for time-series

ts.linetype

line type for time-series

ts.alpha

alpha for time-series

ts.fill

fill colour for time-series

ts.shape

point shape for time-series

geom

same as ts.geom

colour

same as ts.colour

size

same as ts.size

linetype

same as ts.linetype

alpha

same as ts.alpha

fill

same as ts.fill

shape

same as ts.shape

xlim

limits for x axis

ylim

limits for y axis

log

which variables to log transform ("x", "y", or "xy")

main

character vector or expression for plot title

xlab

character vector or expression for x axis label

ylab

character vector or expression for y axis label

asp

the y/x aspect ratio

...

other arguments passed to methods

Value

ggplot

Examples

## Not run: 
data(Canada, package = 'vars')
autoplot(AirPassengers)
autoplot(UKgas, ts.geom = 'bar')
autoplot(Canada)
autoplot(Canada, facets = FALSE)

library(zoo)
autoplot(xts::as.xts(AirPassengers))
autoplot(timeSeries::as.timeSeries(AirPassengers))
its <- tseries::irts(cumsum(rexp(10, rate = 0.1)), matrix(rnorm(20), ncol=2))
autoplot(its)

autoplot(stats::stl(UKgas, s.window = 'periodic'))
autoplot(stats::decompose(UKgas))

## End(Not run)

[Package ggfortify version 0.4.17 Index]