plot.dm_growth_fit: Plot dendrometer growth-fit results

View source: R/plot.dm_growth_fit.R

plot.dm_growth_fitR Documentation

Plot dendrometer growth-fit results

Description

Creates ggplot2-based plots for objects returned by [dm.growth.fit()] and [dm.growth.fit.double()].

The plotting method supports multiple views of fitted dendrometer growth curves, including observed versus fitted trajectories, residuals, timing summaries, overlays of multiple curves, and distributions of fitted model parameters.

The x-axis can be displayed as vegetation-season day, calendar day-of-year (DOY), or actual date, depending on the selected x_axis argument and the type of plot.

When x_axis = "date" and faceting separates individual years or series-year combinations, each facet receives its own x-axis range. This avoids plotting one yearly fitted curve inside the full dendrometer time window when several seasons are present in the input object.

Usage

## S3 method for class 'dm_growth_fit'
plot(
  x,
  type = c("fit", "season", "residuals", "timing", "overlay", "parameters"),
  series = NULL,
  fit_id = NULL,
  facet_by = c("default", "tree", "year", "none"),
  ncol = NULL,
  normalize = FALSE,
  x_axis = c("default", "season_day", "doy", "date"),
  observed_source = c("processed", "original_daily"),
  show_observed = TRUE,
  show_fitted = TRUE,
  show_timing = TRUE,
  point_alpha = 0.7,
  line_width = 0.8,
  legend_position = "right",
  ...
)

Arguments

x

An object of class "dm_growth_fit" returned by [dm.growth.fit()] or [dm.growth.fit.double()].

type

Character string specifying the plot type. One of "fit", "season", "residuals", "timing", "overlay", or "parameters".

series

Optional filter selecting one or more dendrometer series to plot. May be a character vector of series names. Default is NULL, meaning all available series are used.

fit_id

Optional filter selecting one or more fit identifiers to plot. May be a character or numeric vector. Numeric values are coerced internally to character. Default is NULL, meaning all fits are used.

facet_by

Character string controlling faceting layout. One of "default", "tree", "year", or "none".

ncol

Optional integer giving the number of columns in faceted plots. Passed to [ggplot2::facet_wrap()].

normalize

Logical. If TRUE, observed and fitted values are divided by the maximum observed or fitted value within each curve.

x_axis

Character string controlling the x-axis representation. One of "default", "season_day", "doy", or "date".

observed_source

Character string controlling which observed daily series is plotted against the fitted curve. One of "processed" or "original_daily".

show_observed

Logical. If TRUE, observed values are shown in plot types where observed data are relevant.

show_fitted

Logical. If TRUE, fitted values are shown in plot types where fitted curves are relevant.

show_timing

Logical. If TRUE, timing markers are added to "fit" and "season" plots whenever timing information is available in x$fit_statistics.

point_alpha

Numeric alpha level used for observed points.

line_width

Numeric line width used for fitted curves.

legend_position

Character string specifying legend position, passed to [ggplot2::theme()].

...

Further arguments passed to or from other methods.

Details

The plotting method returns a ggplot object. The returned plot can be further modified using normal ggplot2 syntax.

Timing markers are taken from the fit_statistics table inside the "dm_growth_fit" object:

  • growth_start_* and growth_end_* represent growing-season timing based on cumulative fitted growth.

  • rate_start_* and rate_end_* represent active-growth timing based on the fitted growth-rate curve.

  • For double-growth fits, pulse-specific timing such as pulse1_start_*, pulse2_start_*, and separator_* is used in type = "timing" when available.

For yearly fits in southern hemisphere or cross-year custom seasons, calendar timing variables such as growth_start_day and rate_start_day are interpreted as true calendar DOY, while *_season_day variables represent day counts relative to vegetation season start.

In pooled fits, date-based and calendar-DOY timing fields may be unavailable, because pooled fits are not anchored to a single season start date.

Value

A ggplot object.

See Also

[dm.growth.fit()], [dm.growth.fit.double()], [summary.dm_growth_fit()]

Examples


# fit <- dm.growth.fit(...)
# plot(fit, type = "fit")
# plot(fit, type = "fit", facet_by = "year", x_axis = "date")
# plot(fit, type = "fit", facet_by = "year", x_axis = "season_day")
# plot(fit, type = "residuals", facet_by = "year")
# plot(fit, type = "timing")
# plot(fit, type = "parameters")



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