usecol
allows using a color or color palette pal
(e.g., for plotting). usecol
also allows modifying and combining
color palettes in various ways.
usecol( pal = unhcr_pal, n = "all", alpha = NA, use_names = FALSE, use_col_ramp = FALSE )
pal | A color palette (as a vector of colors or color palettes).
Default: |
---|---|
n | An integer value specifying the desired number of colors from the palette.
Default: |
alpha | A factor modifying the opacity alpha (as in |
use_names | A logical value indicating whether colors should be returned as a named vector.
Default: |
use_col_ramp | A logical value specifying whether the default of using pre-selected colors
should be overridden and |
A vector of colors (in character format).
{ usecol(pal = unhcr_pal, n = "all") # default color palette usecol(pal = unhcr_pal, n = 4) # selecting n dedicated colors usecol(pal = unhcr_pal, n = 20) # extending color palette # Mixing a new color palette: pal_1 <- usecol(pal = c(rev(pal_blue), "white", pal_red)) seecol(pal_1) # Mixing and extending a color palette: pal_2 <- usecol(pal = c(rev(pal_green), "white", pal_red), n = 20) seecol(pal_2) }#> Error in parse_pal(pal = pal): Input "pal" does not exist