% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot.daily_output.R
\name{plot.daily_output}
\alias{plot.daily_output}
\title{Plot method for daily dendrometer statistics}
\usage{
\method{plot}{daily_output}(
  x,
  y = NULL,
  Year = NULL,
  DOY = NULL,
  type = c("summary", "amplitude", "minmax_ribbon", "timing", "timing_violin", "lag",
    "change", "boxplot", "heatmap"),
  stat = c("amplitude", "Max_diff", "mean", "median", "Max", "Min", "lag_h",
    "Time_min_h", "Time_max_h"),
  by = c("month", "month_of_year", "year"),
  box_style = c("boxplot", "violin", "both"),
  status_cols = c(growing = "forestgreen", shrinking = "firebrick", stable = "grey60"),
  timing_segment_cols = c(`max after min` = "grey65", `max before/equal min` = "black"),
  ...
)
}
\arguments{
\item{x}{Object of class \code{"daily_output"}.}

\item{y}{Unused.}

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

\item{DOY}{Optional numeric vector of length 2 giving the start and end
day-of-year for subsetting.}

\item{type}{Plot type. One of
\code{"summary"}, \code{"amplitude"}, \code{"minmax_ribbon"},
\code{"timing"}, \code{"timing_violin"}, \code{"lag"}, \code{"change"},
\code{"boxplot"}, or \code{"heatmap"}.}

\item{stat}{Statistic used for \code{type = "boxplot"} or
\code{type = "heatmap"}. One of
\code{"amplitude"}, \code{"Max_diff"}, \code{"mean"},
\code{"median"}, \code{"Max"}, \code{"Min"},
\code{"lag_h"}, \code{"Time_min_h"}, \code{"Time_max_h"}.}

\item{by}{Grouping for \code{type = "boxplot"}:
\code{"month"}, \code{"month_of_year"}, or \code{"year"}.
\code{"month"} uses a continuous calendar-date axis spanning the selected
data window and supports multi-year plotting, for example 2022--2024.
Empty calendar months may appear as gaps, but months with available data
are not clipped at the start or end of the axis.}

\item{box_style}{Style for \code{type = "boxplot"}:
\code{"boxplot"}, \code{"violin"}, or \code{"both"}.}

\item{status_cols}{Colors for \code{Day_status}.}

\item{timing_segment_cols}{Named vector of two colors for the timing connector:
one for \code{"max after min"} and one for \code{"max before/equal min"}.}

\item{...}{Unused.}
}
\value{
A \code{ggplot2} object, returned invisibly.
}
\description{
Unified S3 plotting method for objects returned by \code{daily.data()}.
Missing grouping labels are removed before grouped boxplots are drawn so
\code{NA} does not appear on the x-axis.
}
\details{
Plot types:
\itemize{
  \item \code{"summary"}: daily Min, mean, median, and Max.
  \item \code{"amplitude"}: daily amplitude through time.
  \item \code{"minmax_ribbon"}: ribbon between daily Min and Max.
  \item \code{"timing"}: per-day line connecting daily minimum and maximum timing.
  \item \code{"timing_violin"}: violin distribution of \code{Time_min_h}
        and \code{Time_max_h} for the selected window.
  \item \code{"lag"}: signed lag between daily maximum and minimum time.
  \item \code{"change"}: day-to-day change in daily maximum
        \code{Max_diff}.
  \item \code{"boxplot"}: grouped distributions of a chosen daily statistic.
        For \code{by = "month"}, monthly groups are plotted on a continuous
        date axis. The axis limits are extended beyond the first and last
        plotted month so edge months are not clipped.
  \item \code{"heatmap"}: year x day-of-year heatmap of a chosen daily statistic.
}

For \code{type = "timing"}, the red and blue points are not connected across
days. Instead, each day has its own segment connecting minimum and maximum
time.
}
\examples{
\donttest{
data(nepa17)
dd <- daily.data(df = nepa17[1:1000, ], TreeNum = 1)

plot(dd)
plot(dd, type = "timing")
plot(dd, type = "timing", Year = 2017, DOY = c(1, 6))
plot(dd, type = "timing_violin", Year = 2017, DOY = c(1, 6))
plot(dd, type = "boxplot", stat = "amplitude", by = "month")
plot(dd, type = "boxplot", stat = "amplitude", by = "month_of_year",
     box_style = "both")
plot(dd, type = "change")
}

}
