% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/middleware.R
\name{.directlabel_lines}
\alias{.directlabel_lines}
\title{Choose direct-label anchor points for grouped line data}
\usage{
.directlabel_lines(data, x, y, group, placement, adj_fact, facet_vars)
}
\arguments{
\item{data}{A data frame containing the variables to be labelled.}

\item{x, y}{Unquoted column names giving the x- and y-variables.}

\item{group}{Unquoted column name giving the grouping variable with which to
label lines.}

\item{placement}{Character string giving the preferred label placement
relative to the target point for each group's line. One of "top", "right",
"bottom", or "left".}

\item{adj_fact}{A single numeric value giving the proportional adjustment
applied to the selected label anchor. Values are interpreted relative to
the group-specific x- or y-range.}

\item{facet_vars}{Optional character vector of facet variable names of max
length 2 (or else NULL). When supplied, anchor points are calculated
separately within each group-by-facet combination.}
}
\value{
A tibble with one row per group or group-by-facet combination. The
returned data include standardized x and y columns, .label_plus, and
any grouping or faceting variables needed by ggplot2 to assign labels to
panels correctly.
}
\description{
directlabel_lines() is an internal helper used by
\code{\link[=direct_labels_plus]{direct_labels_plus()}} when geometry = "line". It chooses one endpoint or
extreme point per group, or per group-by-facet combination, to use as the
anchor location for a direct label. How the label is then drawn with respect
to that chosen point is determined by \code{\link[ggrepel:geom_text_repel]{ggrepel::geom_label_repel()}}.
}
\details{
For "right" placement, the helper selects the row with the largest x-value
in each group. For "left", it selects the smallest x-value. For "top",
it selects the largest y-value. For "bottom", it selects the smallest
y-value. After this anchor row is selected, adj_fact can shift the final
label anchor outward or inward along the relevant axis.

This helper is intended for ordinary Cartesian line-like geometries where
endpoint or extreme-value labeling is meaningful. It does not account for
data generated by ggplot2 statistics, transformed scales, or coordinate
transformations. For fitted lines or smooths, callers should pass the
pre-computed fitted data.
}
\keyword{internal}
