View source: R/plot.dm_growth_fit.R
| plot.dm_growth_fit | R Documentation |
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.
## 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",
...
)
x |
An object of class |
type |
Character string specifying the plot type. One of
|
series |
Optional filter selecting one or more dendrometer series to
plot. May be a character vector of series names. Default is |
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 |
facet_by |
Character string controlling faceting layout. One of
|
ncol |
Optional integer giving the number of columns in faceted plots. Passed to [ggplot2::facet_wrap()]. |
normalize |
Logical. If |
x_axis |
Character string controlling the x-axis representation. One of
|
observed_source |
Character string controlling which observed daily
series is plotted against the fitted curve. One of |
show_observed |
Logical. If |
show_fitted |
Logical. If |
show_timing |
Logical. If |
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. |
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.
A ggplot object.
[dm.growth.fit()], [dm.growth.fit.double()], [summary.dm_growth_fit()]
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.