% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geom-fboxplot.R
\docType{data}
\name{ggfboxplot}
\alias{ggfboxplot}
\alias{StatFboxplot}
\alias{stat_fboxplot}
\alias{GeomFboxplot}
\alias{geom_fboxplot}
\title{Functional boxplots for \code{tf} objects}
\usage{
stat_fboxplot(
  mapping = NULL,
  data = NULL,
  geom = "fboxplot",
  position = "identity",
  ...,
  orientation = NA,
  coef = 1.5,
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE,
  depth = "MBD",
  depth_fn = NULL,
  fence_fn = NULL,
  central = 0.5,
  arg = NULL
)

geom_fboxplot(
  mapping = NULL,
  data = NULL,
  stat = "fboxplot",
  position = "identity",
  ...,
  outliers = TRUE,
  outlier.colour = NULL,
  outlier.color = NULL,
  outlier.fill = NULL,
  outlier.shape = NULL,
  outlier.size = NULL,
  outlier.stroke = 0.5,
  outlier.alpha = NULL,
  whisker.colour = NULL,
  whisker.color = NULL,
  whisker.linetype = NULL,
  whisker.linewidth = NULL,
  staple.colour = NULL,
  staple.color = NULL,
  staple.linetype = NULL,
  staple.linewidth = NULL,
  median.colour = NULL,
  median.color = NULL,
  median.linetype = NULL,
  median.linewidth = NULL,
  box.colour = NULL,
  box.color = NULL,
  box.linetype = NULL,
  box.linewidth = NULL,
  notch = FALSE,
  notchwidth = 0.5,
  staplewidth = 0,
  varwidth = FALSE,
  na.rm = FALSE,
  orientation = NA,
  show.legend = NA,
  inherit.aes = TRUE,
  depth = "MBD",
  depth_fn = NULL,
  fence_fn = NULL,
  central = 0.5,
  arg = NULL
)
}
\arguments{
\item{mapping, data, position, show.legend, inherit.aes, na.rm, orientation, ...}{Passed on to \code{\link[ggplot2:layer]{ggplot2::layer()}}.}

\item{coef}{Inflation factor for the central envelope used to define outer fences, defaults to 1.5.}

\item{depth}{Character scalar naming the built-in depth measure passed to
\code{\link[tf:tf_depth]{tf::tf_depth()}} when \code{depth_fn} is \code{NULL}.}

\item{depth_fn}{Optional custom depth function. Must return one numeric depth
value per function.}

\item{fence_fn}{Optional custom fence function. Must return a list with
elements \code{lower}, \code{upper}, and \code{outliers}.}

\item{central}{Fraction of deepest curves used to construct the central
envelope. Defaults to \code{0.5}.}

\item{arg}{Optional evaluation grid used for depth calculation, envelopes, and
drawing. Defaults to the natural grid of the mapped \code{tf}.}

\item{stat, geom}{Use the functional boxplot stat/geom.}

\item{outliers}{Should outlying curves be drawn?}

\item{outlier.colour, outlier.color, outlier.fill, outlier.shape, outlier.size}{Styling parameters for outlier curves.}

\item{outlier.stroke}{Accepted for interface compatibility with
\code{\link[ggplot2:geom_boxplot]{ggplot2::geom_boxplot()}} but ignored because functional outliers are drawn
as curves.}

\item{outlier.alpha}{Alpha used for outlier curves.}

\item{whisker.colour, whisker.color, whisker.linetype, whisker.linewidth}{Styling
parameters for fence lines.}

\item{staple.colour, staple.color, staple.linetype, staple.linewidth}{Accepted for
interface compatibility with \code{\link[ggplot2:geom_boxplot]{ggplot2::geom_boxplot()}} but currently unused.}

\item{median.colour, median.color, median.linetype, median.linewidth}{Styling
parameters for the median curve.}

\item{box.colour, box.color, box.linetype, box.linewidth}{Styling parameters for
the central band outline.}

\item{notch, notchwidth, staplewidth, varwidth}{Accepted for interface
compatibility with \code{\link[ggplot2:geom_boxplot]{ggplot2::geom_boxplot()}} but currently unused.}
}
\value{
A ggplot2 layer.
}
\description{
Draw functional boxplots based on functional depth rankings.
}
\details{
\code{stat_fboxplot()} computes a median curve (thick line), a central region
envelope (filled ribbon), functional fences (dashed lines), and optional
outlying curves (defined as "exceeds the fences somewhere", plotted as solid lines)
from a \code{tf} column. \code{geom_fboxplot()} draws these summaries as a band plus
line layers.

The interface intentionally follows \code{\link[ggplot2:geom_boxplot]{ggplot2::stat_boxplot()}} and
\code{\link[ggplot2:geom_boxplot]{ggplot2::geom_boxplot()}} where this is meaningful for functional data.
Use \code{aes(tf = f)} to map a \code{tf} column. Separate functional boxplots inside a
panel are defined by \code{group}, \code{colour}/\code{color}, or \code{fill}; separate panels are
handled through facetting. Note that only \code{color} or \code{fill} need to be
specified explicitly, as the other will be automatically mapped to the same
variable if not provided.
}
\examples{
\donttest{
library(ggplot2)
set.seed(1312)
data <- data.frame(id = 1:50, grp = rep(c("A", "B"), each = 25))
data$f <- tf_rgp(50) + 5 * (data$grp == "A")

tf_ggplot(data, aes(tf = f, fill = grp)) + # same as `colour = grp` here!
  geom_fboxplot(alpha = 0.3)

tf_ggplot(data, aes(tf = f)) +
  geom_fboxplot(orientation = "y")
}
}
\keyword{datasets}
