plot.ZG_output: Plotting output of zero-growth approach

View source: R/plot.ZG_output.R

plot.ZG_outputR Documentation

Plotting output of zero-growth approach

Description

S3 plot method for output from phase.zg(). It supports tree-level ZG_phase/ZG_cycle outputs and older vignette calls such as plot(zg_out, temporal = "daily").

Usage

## S3 method for class 'ZG_output'
plot(
  x,
  DOY = NULL,
  Year = NULL,
  type = c("gro_twd", "twd", "phase_ribbon", "abr", "phase_summary", "slope_diagnostics",
    "event_timeline", "boxplot", "scatter"),
  temporal = c("raw", "subdaily", "daily", "weekly", "monthly", "yearly", "event",
    "cycle"),
  metric = "ABr.value",
  phase_names = c("TWD", "GRO"),
  cols = c(GRO = "#2c7fb8", TWD = "#d95f0e"),
  point_size = 2.5,
  ribbon_alpha = 0.35,
  show_tree = TRUE,
  stat = NULL,
  phase = "all",
  source = c("ZG_cycle", "ZG_drought"),
  xvar = NULL,
  yvar = NULL,
  fit = c("none", "linear"),
  ...
)

Arguments

x

An object of class "ZG_output", returned by phase.zg().

DOY

Numeric vector with initial and final day of year for plotting, e.g. c(50, 60). If NULL, the full available period is plotted.

Year

Numeric value indicating the calendar year for plotting. Required when DOY is supplied.

type

Character. Plot type, including boxplot for cycle distributions. One of "gro_twd", "twd", "phase_ribbon", "abr", "phase_summary", "slope_diagnostics", or "event_timeline".

temporal

Character. Temporal resolution for phase-level plots.

metric

Character. Event-level metric used for event plots.

phase_names

Character vector with two phase labels.

cols

Named character vector of colours for GRO and TWD.

point_size

Numeric point size.

ribbon_alpha

Numeric transparency for phase ribbons.

show_tree

Logical. If TRUE, tree information is shown in the subtitle.

stat

Numeric cycle column for boxplots; in ZG, an alias for metric.

phase

Phase names to include in boxplots, or all.

source

Table for scatter plots: ZG_cycle (events) or ZG_drought (days).

xvar, yvar

Names of numeric columns in source for scatter axes.

fit

Scatter fit: none or linear, with a 95 percent confidence band.

...

Unsupported arguments raise an error.

Details

For type = boxplot, each cycle/event contributes one observation. Calendar groups use event start dates, retain the year, and do not aggregate values before calculating quartiles. Non-finite measurements are excluded.

Value

A ggplot object. Scatter plots carry scatter_stats and scatter_model attributes. Linear fit statistics assume independent observations and are pooled across the selected rows. Non-finite pairs are excluded.

Examples

library(dendRoAnalyst)
data(gf_nepa17)
zg.phase <- phase.zg(df = gf_nepa17, TreeNum = 1)
plot(zg.phase, DOY = c(50, 51), Year = 2017)
plot(zg.phase, temporal = "daily")


dendRoAnalyst documentation built on Oct. 2, 2026, 9:06 a.m.