View source: R/set_ccf_palette.R
set_ccf_palette | R Documentation |
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)
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 |
library(ggplot2)
set_ccf_palette()
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)])
ggplot(mtcars, aes(wt, mpg, color = factor(cyl))) +
geom_point()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.