plot_ts: Plot time series chart

View source: R/grf_ts.R

plot_tsR Documentation

Plot time series chart

Description

Simple time series plot with points and a line.

Usage

plot_ts(x = NULL, y, label_x = "", label_y = "", color = "black")

Arguments

x

time index (numeric vector) or NULL to use 1:length(y)

y

numeric series

label_x

x-axis label

label_y

y-axis label

color

color for the series

Details

If x is NULL, an integer index 1:n is used. The color applies to both points and line.

Value

returns a ggplot2::ggplot graphic

References

Cleveland, W. S. (1985). The Elements of Graphing Data. Wadsworth. Wickham, H. (2016). ggplot2: Elegant Graphics for Data Analysis. Springer.

Examples

x <- seq(0, 10, 0.25)
y <- sin(x)

grf <- plot_ts(x = x, y = y, color=c("red"))
plot(grf)

tspredit documentation built on Nov. 26, 2026, 1:07 a.m.