% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/network.interpolation.R
\name{plot.network_interpolation}
\alias{plot.network_interpolation}
\title{Plot method for network interpolation output}
\usage{
\method{plot}{network_interpolation}(
  x,
  type = c("interpolation", "uncertainty", "availability", "summary", "validation",
    "coverage", "compare", "seasonal_error"),
  series = NULL,
  start = NULL,
  end = NULL,
  show_pi = TRUE,
  show_fit = FALSE,
  free_y = TRUE,
  ncol = 1,
  summary_metric = c("n_imputed", "n_remaining_na", "n_missing_input", "mean_pi_width",
    "median_pi_width", "mean_ref_n", "median_ref_n", "n_gap_jumps_removed",
    "max_abs_gap_jump"),
  validation_metric = c("MAE", "MAPE", "MdAPE", "RMSE", "Bias", "Success_rate",
    "Mean_PI_width", "Mean_ref_n", "End_value_abs_diff", "Max_abs_diff_within_gap"),
  seasonal_metric = c("mean_error", "mean_abs_error", "mean_abs_pct_error", "rmse",
    "coverage"),
  compare_colour = c("series", "gap_steps"),
  facet = TRUE,
  empty = c("plot", "error"),
  ...
)
}
\arguments{
\item{x}{Object returned by \code{\link{network.interpolation}}.}

\item{type}{Character. Plot type. One of \code{"interpolation"},
\code{"uncertainty"}, \code{"availability"}, \code{"summary"},
\code{"validation"}, \code{"coverage"}, \code{"compare"}, or
\code{"seasonal_error"}.}

\item{series}{Optional character vector of focal series names to plot.}

\item{start}{Optional start datetime for time-based plots.}

\item{end}{Optional end datetime for time-based plots.}

\item{show_pi}{Logical. If \code{TRUE}, show 95\% prediction intervals in
the interpolation plot where available.}

\item{show_fit}{Logical. If \code{TRUE}, show model-implied fitted values in
the interpolation plot where available.}

\item{free_y}{Logical. If \code{TRUE}, facets use free y scales where
applicable.}

\item{ncol}{Integer. Number of facet columns.}

\item{summary_metric}{Character metric used when
\code{type = "summary"}. One of \code{"n_imputed"},
\code{"n_remaining_na"}, \code{"n_missing_input"},
\code{"mean_pi_width"}, \code{"median_pi_width"}, \code{"mean_ref_n"},
\code{"median_ref_n"}, \code{"n_gap_jumps_removed"}, or
\code{"max_abs_gap_jump"}.}

\item{validation_metric}{Character metric used when
\code{type = "validation"}. One of \code{"MAE"}, \code{"MAPE"},
\code{"MdAPE"}, \code{"RMSE"}, \code{"Bias"},
\code{"Success_rate"}, \code{"Mean_PI_width"}, \code{"Mean_ref_n"},
\code{"End_value_abs_diff"}, or \code{"Max_abs_diff_within_gap"}.}

\item{seasonal_metric}{Character metric used when
\code{type = "seasonal_error"}. One of \code{"mean_error"},
\code{"mean_abs_error"}, \code{"mean_abs_pct_error"}, \code{"rmse"},
or \code{"coverage"}.}

\item{compare_colour}{Character. Colouring used when
\code{type = "compare"}. One of \code{"series"} or
\code{"gap_steps"}.}

\item{facet}{Logical. If \code{TRUE}, use faceting where supported.}

\item{empty}{Character. Behavior when no suitable data are available:
\code{"plot"} returns an informative empty plot and \code{"error"} throws
an error.}

\item{...}{Further arguments passed through the generic.}
}
\value{
A \code{ggplot2} object.
}
\description{
S3 plot method for objects returned by
\code{\link{network.interpolation}}.

Depending on \code{type}, the method can display:
\itemize{
  \item interpolated series through time,
  \item uncertainty width,
  \item reference-network availability,
  \item summary diagnostics,
  \item synthetic-gap validation metrics,
  \item interval coverage,
  \item actual versus interpolated validation points,
  \item seasonal validation diagnostics.
}

Jump-corrected post-gap points are marked in the interpolation plot when
jump correction was enabled in \code{\link{network.interpolation}}.
}
\details{
Plot types:
\describe{
  \item{\code{"interpolation"}}{Shows original and interpolated focal series
  through time. Imputed points are highlighted. If jump correction was
  applied, corrected post-gap points are marked in green.}
  \item{\code{"uncertainty"}}{Shows the width of the prediction interval
  through time.}
  \item{\code{"availability"}}{Shows the number of valid reference sensors
  available at each step.}
  \item{\code{"summary"}}{Shows per-series summary diagnostics produced by
  the interpolation run.}
  \item{\code{"validation"}}{Shows synthetic-gap recovery metrics across
  tested gap lengths.}
  \item{\code{"coverage"}}{Shows how often true values fall inside the
  nominal 95\% prediction interval across gap lengths.}
  \item{\code{"compare"}}{Scatter plot of actual versus interpolated values
  from synthetic-gap validation.}
  \item{\code{"seasonal_error"}}{Shows how validation error varies through
  the season, summarized by day of year.}
}

Validation-based plots require that
\code{network.interpolation(..., assess = TRUE)} was used to create
\code{x}.
}
\examples{
\donttest{
#library(dendRoAnalyst)
#data("gf_nepa17")

#df1 <- gf_nepa17
#df1[40:50, "T2"] <- NA

#ref <- cbind(gf_nepa17, gf_nepa17[, 2:3], gf_nepa17[, 2:3])
#colnames(ref) <- c("Time", "T1", "T2", "T3", "T4", "T5", "T6")

#out <- network.interpolation(
#  df1, ref,
#  niMethod = "proportional",
#  n_boot = 100,
#  assess = TRUE,
#  assess_lengths_steps = c(1, 2, 4),
#  correct_gap_jumps = TRUE,
#  jump_threshold = 0.05
#)

#plot(out)
#plot(out, type = "uncertainty")
#plot(out, type = "availability")
#plot(out, type = "summary", summary_metric = "n_gap_jumps_removed")
#plot(out, type = "validation", validation_metric = "MAPE")
#plot(out, type = "coverage")
#plot(out, type = "compare")
#plot(out, type = "seasonal_error", seasonal_metric = "mean_abs_error")
}

}
\seealso{
\code{\link{network.interpolation}}
}
