Learn R Programming

tsforecast (version 1.3.0)

tsscatterplot: Scatter Plot

Description

Produce a scatter plot of two given univariate time series.

Usage

tsscatterplot(
  x,
  y,
  reg = FALSE,
  title = NULL,
  x.name = NULL,
  y.name = NULL,
  pwidth = 1,
  pcol = "steelblue4",
  regwidth = 0.7,
  regcol = "red"
)

Value

A scatter plot of x (values on the x-axis) and y (values on the y-axis) will be displayed with no further values or objects returned.

Arguments

x, y

two univariate time series object or a numeric vector or matrix.

reg

optional. A logical value indicating whether a trend line estimated by regression should be included in the scatter plot. Default is FALSE.

title

title of the histogram. Default is NULL.

x.name

name of the series `x`. If omitted here, the series name found by tsname(x) will be taken over here. If tsname() is NULL, the variable name will be used instead. Default is NULL.

y.name

name of the series `y`. If omitted here, the series name found by tsname(y) will be taken over here. If tsname() is NULL, the variable name will be used instead. Default is NULL.

pwidth

size of the markers in the scatter plot. Default is 1.

pcol

colour of the data points in the scatter plot. Default is `steelblue4`.

regwidth

width of the trend line in the scatter plot. Default is 0.7.

regcol

colour of the trend line in the scatter plot. Default is `red`.

Author

Ka Yui Karl Wu

Examples

Run this code
tsscatterplot(airport$AvgRain, airport$Travellers)

Run the code above in your browser using DataLab