lagged_alignment_plot: Lagged Alignment Plot

View source: R/11-lagged_alignment_plot.R

lagged_alignment_plotR Documentation

Lagged Alignment Plot

Description

Generates a plot to visualize the alignment of two time-series data sets at specified lag times. The function allows for customization of colors, names, point sizes, and various other plotting options.

Usage

lagged_alignment_plot(
  object,
  x_color = "#631879FF",
  y_color = "#E377C2FF",
  x_name = "x",
  y_name = "y",
  which = c("global", "max"),
  x_limit = c(1, 1000),
  non_matched_point_size = 0.1,
  y_point_size = 1,
  x_point_size = 3,
  integrated = FALSE,
  add_connect_line = FALSE,
  add_point = FALSE,
  time_gap = 4
)

Arguments

object

An object that includes time series and index attributes required for plotting.

x_color

Color for the x series in the plot.

y_color

Color for the y series in the plot.

x_name

Label for the x series.

y_name

Label for the y series.

which

Specifies which index to use for alignment ('global' or 'max').

x_limit

A numeric vector specifying the x-axis limits.

non_matched_point_size

Size of the points for non-matched elements in the plot.

y_point_size

Size of the points for y series in the plot.

x_point_size

Size of the points for x series in the plot.

integrated

Logical, if TRUE the plot will integrate over the index to create average values.

add_connect_line

Logical, if TRUE connection lines will be added to the plot.

add_point

Logical, if TRUE points will be added to the plot.

time_gap

The gap of time between breaks in the x-axis.

Details

The function allows for a detailed and nuanced visualization of time-series data. It can integrate over matched indices to provide average values, or it can highlight exact matches. Options to add connecting lines or points enhance the visual representation of alignment.

Value

A ggplot object representing the lagged alignment plot.

Author(s)

Xiaotao Shen shenxt1990@outlook.com

Examples

data("object", package = "laggedcor")

lagged_alignment_plot(object = object,
                      x_limit = c(1, 1000))
lagged_alignment_plot(object = object,
                      x_limit = c(1, 10000),
                      time_gap = 10)

lagged_alignment_plot(
  object = object,
  x_limit = c(1, 100),
  time_gap = 1,
  add_point = TRUE,
  x_point_size = 1,
  y_point_size = 1,
  integrated = TRUE,
  add_connect_line = TRUE
)

lagged_alignment_plot(
  object = object,
  x_limit = c(1, 100),
  time_gap = 1,
  add_point = TRUE,
  x_point_size = 1,
  y_point_size = 1,
  integrated = FALSE
)

jaspershen/laggedcor documentation built on Nov. 9, 2023, 3:44 p.m.