% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geom-pie.R
\name{hd_geom_pie}
\alias{hd_geom_pie}
\title{Pie Geometry Layer for hd Objects}
\usage{
hd_geom_pie(inner_size = "0\%", ...)
}
\arguments{
\item{inner_size}{A string specifying the inner radius of the pie as a percentage
of the total radius.  For example, "50\%" creates a donut chart
with a hole in the middle.  The default "0\%" creates a standard pie chart.
This argument is only applicable to the Highcharts backend; it is ignored
by ggplot2 since it does not support donut charts.}

\item{...}{Geometry-specific arguments forwarded to \code{\link[=hd_make]{hd_make()}}.}
}
\value{
An S3 object of class \code{"hd_geom"} for use with \code{+.hd}.
}
\description{
\code{hd_geom_pie()} creates a pie geometry layer that is added to an \code{\link[=hd]{hd()}}
object via \code{+}.  The layer records the geometry type and any geometry-specific
arguments; rendering only happens when the \code{hd} object is printed.
}
\examples{
# Category share dataset (pie)
drinking_freq <- data.frame(
    category = c("Never", "Rarely", "Monthly", "Weekly", "Daily"),
    pct      = c(18, 25, 30, 20, 7)
)

spec_pie <- hd_spec(drinking_freq,
    x    = "category",
    y    = "pct"
)

opts_pie <- hd_opts(
    title = "Drinking frequency",
    subtitle = "Source: Norwegian Directorate of Health",
    ylab = "Share (\%)"
)

# Donut interactive
hd_make(spec_pie, "pie", opts_pie, inner_size = "50\%")

# Composable API style (ggplot2 ignores inner_size)
hd(drinking_freq, x = "category", y = "pct", backend = "ggplot2") +
    hd_geom_pie() +
    hd_opts(
        title = "Drinking frequency",
        subtitle = "Source: Norwegian Directorate of Health"
    )

}
