This function sets the CCF color palette as the default colors. It does this by adding custom functions,scale_colour_discrete() and scale_fill_discrete(), to the global environment. A typical workflow would include this function at the top of a script, and subsequent calls to ggplot() will utilize the CCF color palette. This function was originally written by Michael Curry at MSK, and only modified here to utilize CCF colors. I also made a few minor changes

set_ccf_palette(palette = "all", reverse = FALSE, colors = NULL)

Arguments

palette

specify the color palette of interest. Default is "all". Other options include "main", "bright", "neutral", "blues", and "greens".

reverse

logical to reverse the color palette. Defaults to FALSE.

colors

an optional argument of hex colors in an unnamed vector. When provided the palette = argument is overridden and the colors supplied will be used. Default is NULL.

Examples

library(ggplot2)
set_ccf_palette()
#> <environment: R_GlobalEnv>
ggplot(mtcars, aes(wt, mpg, color = factor(cyl))) +
  geom_point()


# using the color argument to select a few from the CCF color palette
set_ccf_palette(colors = ccf_palettes[["main"]][c(2,5,6)])
#> <environment: R_GlobalEnv>
ggplot(mtcars, aes(wt, mpg, color = factor(cyl))) +
  geom_point()