scale_color_smith_c | R Documentation |
Smith College themed ggplot2
color palettes
scale_color_smith_c(reverse = FALSE, ...)
scale_fill_smith_c(reverse = FALSE, ...)
scale_color_smith_cd(reverse = FALSE, ...)
scale_fill_smith_cd(reverse = FALSE, ...)
scale_color_smith_d(...)
scale_fill_smith_d(...)
smith_pal_categorical(n)
reverse |
Reverse the order of colors? |
... |
arguments passed to methods |
n |
number of colors desired |
https://drsimonj.svbtle.com/creating-corporate-colour-palettes-for-ggplot2
if (require(ggplot2)) {
x <- ggplot(mtcars, aes(x = disp, y = mpg, color = mpg)) +
geom_point()
x + scale_color_smith_c(reverse = TRUE)
x + scale_color_smith_cd(midpoint = 20)
x + aes(color = factor(am)) + scale_color_smith_d()
x + aes(color = factor(gear)) + scale_color_smith_d()
x + aes(color = factor(carb)) + scale_color_smith_d()
x + aes(color = factor(am)) + scale_fill_smith_d()
y <- ggplot(mtcars, aes(x = cyl, fill = factor(am))) + geom_bar(position = "dodge")
ggplot(mpg, aes(y = hwy, x = reorder(model, hwy), color = displ, fill = hwy)) +
geom_col(position = "dodge") +
coord_flip() +
facet_wrap(~year) +
scale_fill_smith_cd(midpoint = 20) +
scale_color_smith_c()
}
smith_pal_categorical(2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.