% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{prepare_continuous_color_scale}
\alias{prepare_continuous_color_scale}
\title{Prepare continuous color scale limits with quantile/cutoff controls}
\usage{
prepare_continuous_color_scale(
  data,
  column,
  lower_quantile = 0,
  upper_quantile = 0.99,
  lower_cutoff = NULL,
  upper_cutoff = NULL,
  bg_cutoff = NULL
)
}
\arguments{
\item{data}{A data frame.}

\item{column}{The column name in \code{data} to use for the color scale.}

\item{lower_quantile, upper_quantile}{Lower and upper quantiles for the continuous color/fill scale.
The actual cutoffs are determined by these quantiles when \code{lower_cutoff} and
\code{upper_cutoff} are \code{NULL}. Defaults: \code{lower_quantile = 0}, \code{upper_quantile = 0.99}.}

\item{lower_cutoff, upper_cutoff}{Explicit lower and upper cutoffs for the continuous color/fill scale.
When \code{NULL} (the default), the cutoffs are determined by \code{lower_quantile} and
\code{upper_quantile} via \code{\link[stats]{quantile}}. Values outside the
\code{[lower_cutoff, upper_cutoff]} range are clamped (winsorized) to the nearest cutoff value.}

\item{bg_cutoff}{Optional numeric cutoff — values \code{<= bg_cutoff} are
set to \code{NA} before computing cutoffs. Default is \code{NULL}.}
}
\value{
A list with components:
\item{data}{The modified data frame (with winsorized \code{column}).}
\item{feat_colors_value}{Numeric vector of 100 evenly-spaced values from
\code{lower_cutoff} to \code{upper_cutoff}.}
\item{limits}{Numeric vector of length 2 giving the range
\code{c(lower_cutoff, upper_cutoff)}.}
}
\description{
Computes the lower and upper cutoffs for a continuous color/fill scale,
applies data winsorization (clamping), and returns the results needed
by \code{\link[ggplot2]{scale_fill_gradientn}} or
\code{\link[ggplot2]{scale_color_gradientn}}.
}
\keyword{internal}
