% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geoms-layout.R
\name{geom_sankey}
\alias{geom_sankey}
\title{Sankey / alluvial flow diagram}
\usage{
geom_sankey(
  mapping = NULL,
  data = NULL,
  alpha = NULL,
  node_width = NULL,
  label = TRUE
)
}
\arguments{
\item{mapping, data}{Standard layer overrides. Requires \code{x} (source
node), \code{xend} (target node), and \code{y} (flow value).}

\item{alpha}{Ribbon opacity.}

\item{node_width}{Node bar width as a fraction of the panel.}

\item{label}{Draw node labels.}
}
\value{
A \link{Layer} to add with \code{+}.
}
\description{
Shows how quantities move between stages. Nodes are drawn as bars at
each stage and flows as curved ribbons whose thickness is the value.
}
\details{
The layout (node positions, ribbon paths) is computed from scratch:
nodes are stacked within their stage in decreasing size, and ribbons
leave and enter nodes in the same order, which is what keeps the
crossings readable.
}
\examples{
d <- data.frame(
  from = c("Visited", "Visited", "Signed up", "Signed up"),
  to = c("Signed up", "Left", "Purchased", "Churned"),
  n = c(400, 600, 150, 250)
)
ggnext(d, aes(x = from, xend = to, y = n)) +
  geom_sankey() +
  theme_void()
}
