gt_hulk_col_numeric {gtExtras} | R Documentation |
Apply 'hulk' palette to specific columns in a gt table.
Description
The hulk name comes from the idea of a diverging purple and green theme that is colorblind safe and visually appealing. It is a useful alternative to the red/green palette where purple typically can indicate low or "bad" value, and green can indicate a high or "good" value.
Usage
gt_hulk_col_numeric(
gt_object,
columns = NULL,
domain = NULL,
...,
trim = FALSE
)
Arguments
gt_object |
An existing gt table object of class |
columns |
The columns wherein changes to cell data colors should occur. |
domain |
The possible values that can be mapped. For If |
... |
Additional arguments passed to |
trim |
trim the palette to give less intense maximal colors |
Value
An object of class gt_tbl
.
Examples
library(gt) # basic use hulk_basic <- mtcars %>% head() %>% gt::gt() %>% gt_hulk_col_numeric(mpg) hulk_trim <- mtcars %>% head() %>% gt::gt() %>% # trim gives small range of colors gt_hulk_col_numeric(mpg:disp, trim = TRUE) # option to reverse the color palette hulk_rev <- mtcars %>% head() %>% gt::gt() %>% # trim gives small range of colors gt_hulk_col_numeric(mpg:disp, reverse = TRUE)
Figures
Function ID
4-1
See Also
Other Colors:
gt_color_box()
,
gt_color_rows()