% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot_climate_phase.R
\name{dm_plot_climate_compare}
\alias{dm_plot_climate_compare}
\title{Compare multiple climate variables attached to dendrometer outputs}
\usage{
dm_plot_climate_compare(
  x,
  climate_vars = NULL,
  numeric_vars = NULL,
  scale = c("auto", "daily", "cycle", "point"),
  type = c("timeseries", "boxplot", "violin", "both", "cor_heatmap",
    "regression_heatmap"),
  group_var = NULL,
  Year = NULL,
  DOY = NULL,
  box_scales = c("free_y", "fixed"),
  cor_method = c("pearson", "spearman", "kendall"),
  use_pairwise = TRUE,
  regression_stat = c("r.squared", "slope", "p.value"),
  point_alpha = 0.5,
  show_values = FALSE,
  temporal = NULL
)
}
\arguments{
\item{x}{A climate-augmented dendrometer object.}

\item{climate_vars}{Character vector of climate variables to compare. If
\code{NULL}, all detected climate variables at the selected scale are used.}

\item{numeric_vars}{Optional character vector of numeric variables used when
\code{type = "cor_heatmap"} or \code{type = "regression_heatmap"}. If
\code{NULL}, all numeric variables in the selected data are used.}

\item{scale}{Character. Data level to use. One of \code{"auto"},
\code{"daily"}, \code{"cycle"}, or \code{"point"}.}

\item{type}{Character. Plot type. One of \code{"timeseries"},
\code{"boxplot"}, \code{"violin"}, \code{"both"},
\code{"cor_heatmap"}, or \code{"regression_heatmap"}.}

\item{group_var}{Optional character. Grouping variable. If \code{NULL},
\code{Day_status} is used for daily outputs when available, and
\code{Phases} is used for phase outputs.}

\item{Year}{Optional numeric year or vector of years for subsetting.}

\item{DOY}{Optional numeric vector of length 2 giving the day-of-year range.}

\item{box_scales}{Character. Facet scale behavior for grouped plots. One of
\code{"free_y"} or \code{"fixed"}.}

\item{cor_method}{Character. Correlation method. One of \code{"pearson"},
\code{"spearman"}, or \code{"kendall"}.}

\item{use_pairwise}{Logical. If \code{TRUE}, pairwise complete observations
are used in correlations.}

\item{regression_stat}{Character. Statistic shown in regression heatmaps.
One of \code{"r.squared"}, \code{"slope"}, or \code{"p.value"}.}

\item{point_alpha}{Numeric. Alpha value for points.}

\item{show_values}{Logical. If \code{TRUE}, numeric values are printed inside
heatmap tiles.}

\item{temporal}{Deprecated argument kept for compatibility with older
examples. It is ignored.}
}
\value{
A \code{ggplot2} object, returned invisibly.
}
\description{
Plots and compares multiple climate variables attached to climate-augmented
dendrometer outputs. It works with objects of class \code{daily_output_clim},
\code{ZG_output_clim}, and \code{SC_output_clim}.

Supported plot types include faceted time-series, grouped boxplots,
violin plots, combined violin-boxplots, correlation heatmaps, and
regression heatmaps.
}
\details{
For \code{type = "regression_heatmap"}, pairwise simple linear regressions
are fitted as \code{y ~ x} for every variable combination. The heatmap can
display \eqn{R^2}, slope, or p-value.
}
\examples{
\donttest{
data(gf_nepa17)
data(ktm_clim_hourly)

zg <- phase.zg(df = gf_nepa17[1:800, ], TreeNum = 1)
zg_clim <- dm_add_climate(
  zg,
  ktm_clim_hourly,
  scale = "phase",
  mean_vars = c("temp", "VPD", "RH"),
  max_vars  = c("temp", "VPD"),
  sum_vars  = c("prec")
)

dm_plot_climate_compare(
  zg_clim,
  climate_vars = c("temp_mean_phase", "VPD_mean_phase", "RH_mean_phase"),
  scale = "cycle",
  type = "boxplot"
)

plot(
  zg_clim,
  climate_vars = c("temp_mean_phase", "VPD_mean_phase", "RH_mean_phase"),
  scale = "cycle",
  type = "boxplot"
)
}

}
