% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/middleware.R
\name{.apply_key_labels_plus}
\alias{.apply_key_labels_plus}
\title{Apply replacement labels for direct labels}
\usage{
.apply_key_labels_plus(label_data, key_labels)
}
\arguments{
\item{label_data}{A character vector of labels, i.e., the .label_plus
column produced by directlabel_points() or directlabel_lines().}

\item{key_labels}{Optional replacement labels. May be one of:
\itemize{
\item NULL, in which case label_data is returned unchanged;
\item a function applied to label_data, such as a labelling function;
\item a named vector of the form c("old_label" = "New label"); or
\item an unnamed vector with one replacement label per unique group.
}}
}
\value{
A character vector of labels with the same length as label_data.
}
\description{
.apply_key_labels_plus() is an internal helper used by
\code{\link[=direct_labels_plus]{direct_labels_plus()}} to replace default group labels with user-supplied
labels.
}
\details{
Named key_labels are treated as an explicit lookup table. Every unique
value in label_data must appear among the names of key_labels; otherwise,
the helper fails with an informative error.

Unnamed key_labels are assigned to unique labels in alphanumeric order.
This behavior may be surprising, so the helper emits a message recommending
named labels when users want more control.
}
\keyword{internal}
