This package was based on a blog post a read on r-bloggers.com see . When I was making this package I also had a look at ggthemes.
I hope that I found now some nice colors and also want to create a nice theme for CPM.
Install with devtools::install_github("ricoderks/ggCPM")
.
There are 5 different palettes:
Using the CPM colors (discrete values):
ggplot(data = mtcars,
aes(x = wt,
y = mpg)) +
geom_point(aes(colour = as.factor(gear))) +
scale_color_cpm(palette = "main")
Using the CPM colors (continuous values):
ggplot(data = mtcars,
aes(x = wt,
y = mpg)) +
geom_point(aes(colour = gear)) +
scale_color_cpm(palette = "main",
discrete = FALSE)
The CPM theme is based on theme_minimal from ggplot2. For now only the panel background, strip background and strip text are modified.
ggplot(data = mtcars,
aes(x = wt,
y = mpg)) +
geom_point(aes(colour = as.factor(gear))) +
scale_color_cpm(palette = "main") +
theme_cpm()
If you need to modify something else in the theme do this after you call theme_cpm()
ggplot(data = mtcars,
aes(x = wt,
y = mpg)) +
geom_point(aes(colour = as.factor(gear))) +
scale_color_cpm(palette = "main") +
theme_cpm() +
theme(axis.text.x = element_text(size = 6))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.