set_palette | R Documentation |
This function sets the global ggplot2
options for discrete
(ggplot2.discrete.fill
and ggplot2.discrete.colour
) and continuous
(ggplot2.continuous.fill
and ggplot2.continuous.colour
) palettes to
specified palettes from the dunnr
package.
Use help(scale_colour_discrete)
to see how these options work.
set_palette(discrete_pal = "pastel6", continuous_pal = "div5")
discrete_pal |
One of the palettes from |
continuous_pal |
One of the palettes from |
# Sets pastel6 for discrete and div5 for continuous as the default palettes set_palette() library(ggplot2) library(dplyr) p <- diamonds %>% filter(carat >= 2.2) %>% ggplot(aes(x = price, y = cut, fill = cut)) + geom_boxplot() + theme(legend.position = "none") p p <- faithfuld %>% ggplot(aes(waiting, eruptions, fill = density)) + geom_tile() + scale_x_continuous(expand = c(0, 0)) + scale_y_continuous(expand = c(0, 0)) p
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.