% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geoms-clinical.R
\name{geom_swimmer}
\alias{geom_swimmer}
\title{Swimmer plot}
\usage{
geom_swimmer(
  mapping = NULL,
  data = NULL,
  bar_height = 0.6,
  arrow = TRUE,
  alpha = NULL
)
}
\arguments{
\item{mapping, data}{Standard layer overrides. Map duration to \code{x}, the
subject to \code{y}, and (optionally) response category to \code{color}. Map
\code{label} to a logical "still ongoing" flag to draw arrowheads.}

\item{bar_height}{Bar thickness in category-slot units.}

\item{arrow}{Draw arrowheads for ongoing subjects.}

\item{alpha}{Bar opacity.}
}
\value{
A \link{Layer} to add with \code{+}.
}
\description{
One horizontal bar per subject showing time on treatment, with optional
arrowheads for subjects still ongoing at the data cutoff — the standard
patient-level timeline in oncology reporting.
}
\examples{
d <- data.frame(
  subject = paste0("S", 1:6),
  months = c(4, 9, 14, 6, 20, 11),
  response = c("PR", "CR", "CR", "SD", "PR", "SD"),
  ongoing = c(FALSE, FALSE, TRUE, FALSE, TRUE, FALSE)
)
ggnext(d, aes(months, subject, color = response, label = ongoing)) +
  geom_swimmer() +
  labs(title = "Time on treatment", x = "Months", y = NULL)
}
