Generate vectors of hex color codes from the palettes available in ggastrum. 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.
Usage
solaris_pal(n = 6)
viridis_pal(n = 6)
grayscale_pal(n = 6)
inferno_pal(n = 6)
doplar_pal(n = 6)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.doplar_palBlue-to-red diverging palette based on ColorBrewer RdBu. Pairs well with the
theme_solaristheme for showing diverging data.
The global palette used by ggplot2 scales can be set via
set_theme(palette = ...).
Examples
solaris_pal(5)
#> [1] "#3B0A45" "#452B7B" "#2E6E8E" "#44BD6B" "#FFD700"
viridis_pal(5)
#> [1] "#440154FF" "#3B528BFF" "#21908CFF" "#5DC863FF" "#FDE725FF"
inferno_pal(5)
#> [1] "#000004FF" "#56106EFF" "#BB3754FF" "#F98C0AFF" "#FCFFA4FF"
grayscale_pal(5)
#> [1] "#000000" "#6D6D6D" "#959595" "#B3B3B3" "#CCCCCC"
doplar_pal(5)
#> [1] "#2166ac" "#4393c3" "#67a9cf" "#d1e5f0" "#f7f7f7"
