% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pep_quality.R
\name{plot.pep_quality}
\alias{plot.pep_quality}
\title{Plot Method for Data Quality Assessment}
\usage{
\method{plot}{pep_quality}(
  x,
  which = c("overview", "grades", "map"),
  pep = NULL,
  show_grades = c("A", "B", "C", "D"),
  alpha = 0.6,
  title = NULL,
  ...
)
}
\arguments{
\item{x}{A \code{pep_quality} object.}

\item{which}{Character. Type of plot to produce:
\itemize{
\item \code{"overview"} (default): Two-panel overview with grade
distribution and station quality map (requires \code{pep} argument)
\item \code{"grades"}: Bar chart of quality grade distribution only
\item \code{"map"}: Map of station locations colored by quality grade
(requires \code{pep} argument for coordinates)
}}

\item{pep}{Optional \code{pep} object providing station coordinates (lon, lat).
Required for \code{which = "map"} or \code{which = "overview"}.}

\item{show_grades}{Character vector of grades to display on the map.
Default is \code{c("A", "B", "C", "D")} (all grades). Use e.g.
\code{show_grades = "D"} to show only poor-quality stations.}

\item{alpha}{Numeric. Transparency of points on the map (0-1). Default is 0.6.}

\item{title}{Optional character string for the plot title.}

\item{...}{Additional arguments (unused).}
}
\value{
A ggplot object (invisibly).
}
\description{
Creates visualizations of phenological data quality metrics, including
grade distribution and a map of station quality.
}
\details{
For the map visualization, the function:
\itemize{
\item Aggregates quality to one grade per station (worst grade if multiple phases)
\item Uses country borders from the \code{rnaturalearth} package
\item Uses colorblind-friendly colors (blue=A, cyan=B, orange=C, vermillion=D)
}
}
\examples{
\donttest{
pep <- pep_download()

# Assess quality for Swiss stations
pep_ch <- pep[country == "Switzerland"]
quality <- pep_quality(pep_ch, by = c("s_id", "phase_id"))

# Grade distribution only (no pep data needed)
plot(quality, which = "grades")

# Map of station quality (requires pep for coordinates)
plot(quality, which = "map", pep = pep_ch)

# Map showing only poor-quality stations
plot(quality, which = "map", pep = pep_ch, show_grades = "D")

# Map showing problematic stations (C and D grades)
plot(quality, which = "map", pep = pep_ch, show_grades = c("C", "D"))

# Overview: grades + map
plot(quality, pep = pep_ch)
}

}
\author{
Matthias Templ
}
