
Color a numeric gt column and add a matching quantile legend
gtscale_data_color_quantiles.RdThis is the primary interface for quantile scales in gtscales.
Usage
gtscale_data_color_quantiles(
data,
column,
palette,
quantiles = 4,
oob = NULL,
right = FALSE,
labels = NULL,
title = NULL,
width = "180px",
height = "14px",
apply_to = c("fill", "text"),
na_color = NULL,
alpha = NULL,
reverse = FALSE,
autocolor_text = TRUE,
contrast_algo = c("apca", "wcag"),
autocolor_light = "#FFFFFF",
autocolor_dark = "#000000"
)Arguments
- data
A
gt_tblcreated bygt::gt().- column
A numeric, Date, POSIXt, or difftime column to color and legendize.
- palette
A vector of colors, palette endpoints, a single named palette, or a palette function used for the quantile groups.
- quantiles
The number of quantile groups.
- oob
Out-of-bounds handling function or shortcut. Use a function like
scales::oob_squish()or a shortcut such as"censor"or"squish".- right
Whether intervals should be closed on the right. The default of
FALSEyields intervals like[a, b).- labels
An optional labeling function or a character vector for the quantile ranges. When a function is supplied, it is applied to the quantile boundaries before interval labels are constructed.
- title
Optional legend title.
- width
Width of the legend.
- height
Height of the swatches.
- apply_to
Whether colors should be applied to cell fill or text.
- na_color
Color used for missing values.
- alpha
Alpha applied by
gt::data_color().- reverse
Whether to reverse the color mapping.
- autocolor_text
Whether to automatically adjust text color.
- contrast_algo
Contrast algorithm passed to
gt::data_color().- autocolor_light
Light text color used by
gt::data_color().- autocolor_dark
Dark text color used by
gt::data_color().
Value
A modified gt::gt table.