% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geoms-ml.R
\name{geom_shap}
\alias{geom_shap}
\title{SHAP value beeswarm}
\usage{
geom_shap(mapping = NULL, data = NULL, size = NULL, alpha = NULL)
}
\arguments{
\item{mapping, data}{Standard layer overrides. Map the SHAP value to \code{x}
and the feature name to \code{y}; map \code{color} to the feature value.}

\item{size}{Point radius in px.}

\item{alpha}{Point opacity.}
}
\value{
A \link{Layer} to add with \code{+}.
}
\description{
One horizontal swarm per feature showing every observation's SHAP value,
with points nudged vertically so overlapping values stay countable.
Color the points by the feature value to read the direction of effect.
}
\examples{
set.seed(1)
d <- data.frame(
  feature = rep(c("age", "income", "tenure"), each = 40),
  shap = c(rnorm(40, 0.3, 0.2), rnorm(40, -0.1, 0.3), rnorm(40, 0, 0.15)),
  value = runif(120)
)
ggnext(d, aes(shap, feature, color = value)) +
  geom_shap() +
  geom_vline(0, dash = "3,3") +
  labs(title = "SHAP value by feature", x = "SHAP value", y = NULL)
}
