scale_chrestos | R Documentation |
Add a Chrestos color palette to the color
or fill
aesthetic of a ggplot.
scale_color_chrestos( palette = "main", discrete = TRUE, reverse = FALSE, shade = 0.5, customPalettes = NULL, ... ) scale_fill_chrestos( palette = "main", discrete = TRUE, reverse = FALSE, shade = 0.5, customPalettes = NULL, ... )
palette |
Name of the color palette (character). Use |
discrete |
Use a discrete ( |
reverse |
Use the selected palette in original ( |
shade |
Numeric vector in [0,1] that defines the brightness of the palettes. Values higher then 0.5 lead to brighter colors than the original shade, values lower than 0.5 lead to darker colors. |
customPalettes |
If desired, a named list of custom palettes with the same structure as |
... |
Further arguments to pass to |
#color on discrete scale iris %>% ggplot(aes(x = Sepal.Length, y = Sepal.Width, color = Species)) + geom_point(size = 4, alpha = 0.8) + scale_color_chrestos(palette = "minimal") + theme_light() #color on discrete scale with custom palette (also works with hex codes instead of names) my_palettes<- list(theonlyone = c("dodgerblue", "forestgreen", "firebrick", "gold")) iris %>% ggplot(aes(x = Petal.Length, y = Petal.Width, color = Species)) + geom_point(size = 4, alpha = 0.8) + scale_color_chrestos(palette = "theonlyone", customPalettes = my_palettes) + theme_light() #fill on continuous scale with reverse palette faithfuld %>% ggplot(aes(x = waiting, y = eruptions, fill = density)) + geom_raster(interpolate = TRUE) + scale_fill_chrestos(palette = "grad4", discrete = FALSE, reverse = TRUE) + theme_void()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.