plot.dm_wavelet: Plot method for wavelet analysis output

View source: R/dm_wavelet.R

plot.dm_waveletR Documentation

Plot method for wavelet analysis output

Description

S3 plotting method for objects returned by dm_wavelet().

The function provides three main visualization types:

  • "series": plots the analyzed input dendrometer series over time,

  • "average": plots the average wavelet power spectrum against period,

  • "power": plots the full wavelet power spectrum as a time-period image.

Periods are shown in hours, regardless of the original temporal resolution of the input series. For power plots, the x-axis shows the actual time series timestamps and the y-axis shows the wavelet period in hours.

Usage

## S3 method for class 'dm_wavelet'
plot(
  x,
  y = NULL,
  series = NULL,
  type = c("power", "average", "series"),
  facet = TRUE,
  log_period = TRUE,
  log_power = TRUE,
  clip_quantile = c(0.01, 0.99),
  show_sig = TRUE,
  show_coi = TRUE,
  coi_fill = "white",
  coi_alpha = 0.45,
  siglvl = 0.05,
  sig_color = "black",
  sig_size = 0.4,
  main = NULL,
  ...
)

Arguments

x

An object of class "dm_wavelet" returned by dm_wavelet().

y

Unused.

series

Optional character vector giving one or more series names to plot. If NULL, the first available series is used.

type

Character string specifying the plot type. One of:

'"power"'

Wavelet power spectrum as a raster image.

'"average"'

Average wavelet power spectrum across the full time series.

'"series"'

Original analyzed series over time.

facet

Logical. If TRUE and more than one series is selected, panels are faceted by series.

log_period

Logical. If TRUE, the period axis is shown on a log10 scale where applicable.

log_power

Logical. If TRUE and type = "power", the plotted wavelet power is transformed using log10(power + eps) to improve contrast.

clip_quantile

Optional numeric vector of length 2 giving lower and upper quantiles used to clip wavelet power before plotting, for example c(0.01, 0.99). This is useful when a few extreme values dominate the colour scale. Use NULL to disable clipping.

show_sig

Logical. If TRUE, overlays significance information when available. For type = "average", significant periods are marked as points. For type = "power", significant regions are shown as contour lines.

show_coi

Logical. If TRUE and type = "power", the cone of influence (COI) is added as a shaded overlay.

coi_fill

Fill colour used for the cone of influence shading.

coi_alpha

Numeric transparency of the cone of influence shading.

siglvl

Numeric significance threshold between 0 and 1. Default is 0.05.

sig_color

Colour used for significance overlays.

sig_size

Line width or point size used for significance overlays.

main

Optional plot title. If NULL, a default title is used.

...

Further arguments passed to or from other methods. Currently unused.

Details

For type = "power", the function uses the wavelet power matrix stored in the "dm_wavelet" object and converts the Fourier periods to hours. The power plot may also show:

  • significance contours, when p-values are available,

  • the cone of influence (COI), when COI information is available.

For type = "average", the function plots the average wavelet power spectrum and may optionally indicate significant periods when average-spectrum p-values are available.

For type = "series", the original analyzed series are plotted without any wavelet transformation.

Value

A ggplot2 object.

See Also

dm_wavelet, ggplot

Examples


wv <- dm_wavelet(
  x = gf_nepa17,
  TreeNum = 1:2,
  source = "raw",
  make_pval = TRUE,
  verbose = FALSE
)

# original series
plot(wv, type = "series")

# average wavelet power
plot(wv, type = "average")

# full power spectrum
plot(wv, type = "power")

# one selected series
plot(wv, series = names(wv$results)[1], type = "power")

# stronger contrast in the power plot
plot(
  wv,
  type = "power",
  log_power = TRUE,
  clip_quantile = c(0.05, 0.95)
)



dendRoAnalyst documentation built on May 20, 2026, 5:07 p.m.