% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pheno_timeseries.R
\name{pheno_plot_timeseries}
\alias{pheno_plot_timeseries}
\title{Plot Phenological Time Series}
\usage{
pheno_plot_timeseries(
  data,
  color_by = "species",
  facet_by = NULL,
  alpha_lines = 0.7,
  linewidth = 0.8,
  smooth = TRUE,
  se = FALSE,
  year_min = 1961,
  title = "Phenological time series of flowering (BBCH 65)"
)
}
\arguments{
\item{data}{A data.frame or data.table containing at least \code{year}, \code{day} (day-of-year), and one grouping variable
(e.g. \code{species}, \code{phase}, or \code{functional_group}).}

\item{color_by}{Character. Column name used for color grouping (default = "species").}

\item{facet_by}{Character or NULL. Optional column name for faceting (e.g. "functional_group").}

\item{alpha_lines}{Numeric. Transparency level for time-series lines (default = 0.7).}

\item{linewidth}{Numeric. Line width (default = 0.8).}

\item{smooth}{Logical. If TRUE, adds a linear trend smoother (default = TRUE).}

\item{se}{Logical. Whether to display confidence interval for smoother (default = FALSE).}

\item{year_min}{Numeric. Minimum year to plot (default = 1961).}

\item{title}{Character. Optional plot title.}
}
\value{
A ggplot object.
}
\description{
Visualizes phenological day-of-year (DOY) trends over time since 1961.
Designed for aggregated or site-level phenology data from PEP725.
}
\examples{
\donttest{
pep <- pep_download()

# Use Alpine subset for faster computation
pep_alpine <- pep[country \%in\% c("Switzerland", "Austria")]

# Example: flowering DOY by genus
pheno_plot_timeseries(data = pep_alpine[phase_id == 65],
                      color_by = "genus",
                      facet_by = NULL, smooth = TRUE)

# Example: single species, colored by site (grapevine has longest records)
vine_data <- pep_alpine[species == "Vitis vinifera" & phase_id == 65]
if (nrow(vine_data) > 0) {
  pheno_plot_timeseries(
    data = vine_data,
    color_by = "s_id",
    smooth = TRUE,
    title = "Grapevine flowering (BBCH 65) across sites"
  )
}

# Example: facets by genus
pheno_plot_timeseries(
  data = pep_alpine[phase_id == 65],
  color_by = "species",
  facet_by = "genus",
  smooth = TRUE
)
}
}
\author{
Matthias Templ
}
