
Prepare continuous color scale limits with quantile/cutoff controls
Source:R/utils.R
prepare_continuous_color_scale.RdComputes the lower and upper cutoffs for a continuous color/fill scale,
applies data winsorization (clamping), and returns the results needed
by scale_fill_gradientn or
scale_color_gradientn.
Usage
prepare_continuous_color_scale(
data,
column,
lower_quantile = 0,
upper_quantile = 0.99,
lower_cutoff = NULL,
upper_cutoff = NULL,
bg_cutoff = NULL
)Arguments
- data
A data frame.
- column
The column name in
datato use for the color scale.- lower_quantile, upper_quantile
Lower and upper quantiles for the continuous color/fill scale. The actual cutoffs are determined by these quantiles when
lower_cutoffandupper_cutoffareNULL. Defaults:lower_quantile = 0,upper_quantile = 0.99.- lower_cutoff, upper_cutoff
Explicit lower and upper cutoffs for the continuous color/fill scale. When
NULL(the default), the cutoffs are determined bylower_quantileandupper_quantileviaquantile. Values outside the[lower_cutoff, upper_cutoff]range are clamped (winsorized) to the nearest cutoff value.- bg_cutoff
Optional numeric cutoff — values
<= bg_cutoffare set toNAbefore computing cutoffs. Default isNULL.