| apply_gg_colors | R Documentation |
Uses the same resolve_colors() priority chain as the highcharter
engine so both backends always produce identical colour assignments:
apply_gg_colors(p, colors = NULL, n_groups = NULL, group_levels = NULL)
p |
A ggplot object. |
colors |
Character vector, palette name string, or NULL. |
n_groups |
Integer. Number of groups in the data. Drives which
palette rule fires. Passed from |
group_levels |
Character vector or NULL. Group level names in data order. Used to name the palette so ggplot2 matches colours to groups by name rather than alphabetical sort. |
Explicit colors argument
getOption("highdir.colors") session default
Built-in rules: n==2 -> hdir2, n<=10 -> hdir[1:n], n>10 -> viridis
The modified ggplot object.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.