powered by
Change color palette. change_palette() is an alias of set_palette().
change_palette()
set_palette()
set_palette(p, palette)change_palette(p, palette)
change_palette(p, palette)
a ggplot
Color palette. Allowed values include:
Grey color palettes: "grey" or "gray";
RColorBrewer palettes, see brewer.pal and details section. Examples of palette names include: "RdBu", "Blues", "Dark2", "Set2", ...;
brewer.pal
Custom color palettes. For example, palette = c("#00AFBB", "#E7B800", "#FC4E07");
ggsci scientific journal palettes, e.g.: "npg", "aaas", "lancet", "jco", "ucscgb", "uchicago", "simpsons" and "rickandmorty".
get_palette.
# Load data data("ToothGrowth") df <- ToothGrowth # Basic plot p <- ggboxplot(df, x = "dose", y = "len", color = "dose") p # Change the color palette set_palette(p, "jco")
Run the code above in your browser using DataLab