% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geoms-ml.R
\name{geom_importance}
\alias{geom_importance}
\title{Feature importance plot}
\usage{
geom_importance(mapping = NULL, data = NULL, color = NULL, linewidth = NULL)
}
\arguments{
\item{mapping, data}{Standard layer overrides. Map the importance value
to \code{x} and the feature name to \code{y}; map \code{ymin}/\code{ymax} for whiskers.}

\item{color}{Marker and whisker color.}

\item{linewidth}{Whisker width.}
}
\value{
A \link{Layer} to add with \code{+}.
}
\description{
A ranked point-and-whisker plot of feature importance, with optional
whiskers from \code{ymin}/\code{ymax} (e.g. permutation-importance standard
errors) and a reference line at zero importance. Built on the same
point+whisker rendering as \code{\link[=geom_forest]{geom_forest()}}.
}
\details{
A discrete axis otherwise sorts alphabetically; pass \code{y} as a factor
already ordered by importance (ascending, since the first level sits
at the panel's bottom) to get the classic "most important at the top"
layout — the same convention \code{\link[=geom_waterfall]{geom_waterfall()}} uses for category
order.
}
\examples{
d <- data.frame(
  feature = c("age", "income", "tenure", "region"),
  imp = c(0.42, 0.31, 0.18, 0.05),
  se = c(0.05, 0.04, 0.03, 0.02)
)
d$feature <- factor(d$feature, levels = d$feature[order(d$imp)])
ggnext(d, aes(imp, feature, ymin = imp - se, ymax = imp + se)) +
  geom_importance() +
  labs(title = "Permutation importance", x = "Importance", y = NULL)
}
