Generate vectors of hex color codes from the four palettes available in text2map.theme. Each palette is designed for smooth gradients and colorblind accessibility. These functions are useful for base R plots, manual color specifications, or any context where a vector of colors is needed.
Details
viridis_palPerceptually uniform (viridis option D). Purple to yellow gradient.
inferno_palPerceptually uniform (viridis option B). Dark purple to yellow gradient.
grayscale_palBlack-to-light-grey gradient. Best for print publications.
solaris_palCustom purple-to-gold gradient via Lab-space interpolation. Pairs with
theme_solaris.
The global palette used by ggplot2 scales can be set via
set_theme(palette = ...).
Examples
solaris_pal(5)
#> [1] "#2A0132" "#215AA9" "#009392" "#72BC5A" "#FFD700"
viridis_pal(5)
#> function (n)
#> {
#> viridisLite::viridis(n, alpha, begin, end, direction, option)
#> }
#> <bytecode: 0x5902b4c68b18>
#> <environment: 0x5902b6ce7cb0>
#> attr(,"class")
#> [1] "pal_discrete" "scales_pal" "function"
#> attr(,"type")
#> [1] "colour"
#> attr(,"nlevels")
#> [1] 255
inferno_pal(5)
#> [1] "#000004FF" "#56106EFF" "#BB3754FF" "#F98C0AFF" "#FCFFA4FF"
grayscale_pal(5)
#> [1] "#000000" "#6D6D6D" "#959595" "#B3B3B3" "#CCCCCC"
