rawplot: Draw a simple time series plot

plot.inz_tsR Documentation

Draw a simple time series plot

Description

Draws a plot of a given inzightts (inz_ts) object with the trend superimposed.

Usage

## S3 method for class 'inz_ts'
plot(
  x,
  var = NULL,
  xlab = NULL,
  ylab = NULL,
  title = NULL,
  xlim = NULL,
  aspect = NULL,
  compare = TRUE,
  pal = NULL,
  smoother = TRUE,
  sm_model = "stl",
  t = 0,
  mult_fit = FALSE,
  emphasise = NULL,
  non_emph_opacity = 0.2,
  show_iso_obs = TRUE,
  iso_obs_size = 1,
  seasonal_adjustment = FALSE,
  ...
)

Arguments

x

An inzightts (inz_ts) object representing the time series.

var

A character vector specifying the variable(s) to be plotted, or set to NULL.

xlab

A title for the x-axis of the plot.

ylab

A title for the y-axis of the plot.

title

A title for the graph.

xlim

Axis limits, specified as dates or years.

aspect

The aspect ratio of the plot; it will be about aspect times wider than it is high.

compare

Logical; set to TRUE to plot the key levels in a single plot.

pal

(Only if a categorical variable is passed to var): The colour palette for the categorical plot. The palette vector should be in the same order per the rows of tsibble::key_data(x).

smoother

Logical; if TRUE, the smoother will be drawn.

sm_model

The smoothing method to be used.

t

The smoothing parameter (between 0 and 100).

mult_fit

Logical; set to TRUE for a multiplicative model, or FALSE for the default additive model.

emphasise

Integer vector to specify the key level(s) to focus in the plot. The integer maps to the specific key level(s) corresponding to the ith row of tsibble::key_data(x).

non_emph_opacity

Numeric. If ⁠(0, 1]⁠, this argument determines the opacity of the series other than the focused one(s) (to highlight the focused series). If non_emph_opacity = 0, the plot draws the focused series in its own scales.

show_iso_obs

Logical; set to TRUE to plot isolated observations between time series gaps (if any).

iso_obs_size

Numeric; scaling the size of isolated observations, if show_iso_obs = TRUE and they exist.

seasonal_adjustment

Logical; set to TRUE to show the seasonally adjusted time series (i.e., removed the estimated seasonal effects as determined by STL decomoposition; see decomp()).

...

Additional arguments (ignored).

Value

A time series plot (constructed with ggplot2) is returned, which can be added to if desired.

See Also

key_data

Examples

t <- inzightts(visitorsQ, var = c(2, 4))

## Not run: 
plot(t)
plot(t, var = names(t)[-1])
plot(t, var = "Japan")
plot(t, mult_fit = TRUE)

## End(Not run)


iNZightVIT/iNZightTS documentation built on May 4, 2024, 9:28 a.m.