Skip to contents

Plot anomalies with error bands and significance

Usage

plot_anomaly(
  anom.df,
  tzero = NULL,
  val_col = "observed",
  time_col = "GPS",
  err_lwr = NULL,
  err_upr = NULL,
  xlim = NULL,
  ylim = NULL,
  p_crit = 0.05,
  p_col = "P0",
  sig_color = "red",
  lowsig_color = "grey50"
)

Arguments

anom.df

A data.frame with anomaly results.

tzero

Optional time zero to align the time axis.

val_col

Column name for the observed signal value.

time_col

Column name for the time values (usually "GPS").

err_lwr

Column name for lower error band. If NULL, auto-detect.

err_upr

Column name for upper error band. If NULL, auto-detect.

xlim

A numeric vector. X axis limits (default: NULL).

ylim

A numeric vector. Y axis limits (default: NULL).

p_crit

Critical p-value threshold (default: 0.05).

p_col

Column name for p-values (default: "P0").

sig_color

Color for significant anomalies (default: "red").

lowsig_color

Color for low-significance anomalies (default: "grey50").

Value

A ggplot object.