% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/events_phase_plots.R
\name{plot_event_climate_box}
\alias{plot_event_climate_box}
\title{Plot event-based climate distributions}
\usage{
plot_event_climate_box(
  event_data,
  climate_var,
  group_var = c("Phase", "event_type"),
  facet_by = c("none", "month", "month_of_year", "year"),
  Year = NULL,
  DOY = NULL,
  geom = c("boxplot", "violin", "both"),
  add_test = TRUE,
  test_method = c("auto", "anova", "kruskal", "t.test", "wilcox"),
  point_alpha = 0.5
)
}
\arguments{
\item{event_data}{Output of \code{dm_event_climate()}.}

\item{climate_var}{Name of the climate-derived column to plot.}

\item{group_var}{Grouping variable. One of \code{"Phase"} or \code{"event_type"}.}

\item{facet_by}{One of \code{"none"}, \code{"month"}, \code{"month_of_year"}, or \code{"year"}.}

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

\item{DOY}{Optional numeric vector of length 2 for filtering.}

\item{geom}{One of \code{"boxplot"}, \code{"violin"}, or \code{"both"}.}

\item{add_test}{Logical. If \code{TRUE}, adds per-panel test results.}

\item{test_method}{Passed to \code{dm_event_climate_test()}.}

\item{point_alpha}{Point transparency.}
}
\value{
A \code{ggplot2} object.
}
\description{
Draws boxplots or violins of event-based climate variables across phases or
event types, with optional significance annotation.
}
\examples{
\donttest{
data(gf_nepa17)
data(ktm_clim_hourly)

zg <- phase.zg(df = gf_nepa17[1:800, ], TreeNum = 1)
evt_zg <- dm_event_climate(
  zg,
  ktm_clim_hourly,
  event = "phase_start",
  windows = c(0, 3, 6, 12, 24),
  mean_vars = c("temp", "VPD", "RH"),
  max_vars  = c("VPD"),
  sum_vars  = c("prec")
)

if (any(!is.na(evt_zg$VPD_mean_prev_6h))) {
  plot_event_climate_box(
    evt_zg,
    climate_var = "VPD_mean_prev_6h",
    group_var = "Phase",
    facet_by = "month_of_year",
    geom = "both",
    add_test = TRUE
  )
}
}

}
