% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geom-arearange.R
\name{hd_geom_arearange}
\alias{hd_geom_arearange}
\title{Add an Arearange (Confidence Band) Layer}
\usage{
hd_geom_arearange(ymin = NULL, ymax = NULL, ...)
}
\arguments{
\item{ymin}{Character. Column name for the lower bound of the range.}

\item{ymax}{Character. Column name for the upper bound of the range.}

\item{...}{Additional optional arguments forwarded to the geom function
(e.g. \code{show_line = FALSE}, \code{single_colour = "#025169"}).
Run \code{geom_args("arearange")} for the full list.}
}
\value{
An S3 object of class \code{"hd_geom"} for use with \code{+.hd}.
}
\description{
Geometry layer for ribbon / confidence-interval charts.  Unlike the other
\verb{hd_geom_*()} functions, \code{ymin} and \code{ymax} are \strong{required} named arguments
(they map to column names in \code{spec$data}) rather than optional \code{...} extras.
This makes the contract explicit at the call site instead of burying
required information inside \code{...}.
}
\examples{

# Single series
spec_ar1 <- hd_spec(alco1,
                    x    = "year",
                    y    = "adj_enhet")

opts_ar <- hd_opts(
  title    = "Alcohol consumption with 95\% CI",
  subtitle = "Source: Norwegian Directorate of Health",
  ylim     = c(0, 30),
  ylab = "Number of units alcohol"
)

hd_make(spec_ar1, "arearange", opts_ar,
       ymin = "lower_enhet", ymax = "upper_enhet")

# Static ggplot2 version
hd_make(spec_ar1, "arearange", opts_ar,
       ymin = "lower_enhet", ymax = "upper_enhet", backend = "ggplot2")

#' # Multi-series with group column
# Grouped by kjonn
spec_ar2 <- hd_spec(alco2,
                    x     = "year",
                    y     = "adj_enhet",
                    group = "kjonn")

hd_make(spec_ar2, "arearange", opts_ar,
        ymin = "lower_enhet", ymax = "upper_enhet")

}
