Last active
May 8, 2019 09:42
-
-
Save baptiste/8db48ede1eacb22cdd78093f715cb945 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
# dput(ls(pattern = "theme",package:ggplot2)) | |
defaults <- c("theme_bw", "theme_classic", "theme_dark", | |
"theme_grey", "theme_light", "theme_linedraw", | |
"theme_minimal", "theme_void") | |
library(ggthemes) | |
# dput(ls(pattern = "theme",package:ggthemes)) | |
addons <- c("theme_base", "theme_calc", "theme_economist", | |
"theme_economist_white", "theme_excel", "theme_few", "theme_fivethirtyeight", | |
"theme_foundation", "theme_gdocs", "theme_hc", "theme_igray", | |
"theme_map", "theme_pander", "theme_par", "theme_solarized", | |
"theme_solarized_2", "theme_solid", "theme_stata", "theme_tufte", | |
"theme_wsj") | |
p <- ggplot(mtcars) + facet_wrap(~vs) + | |
stat_qq(aes(sample = mpg, colour = factor(cyl)), geom="line") | |
pl1 <- lapply(defaults, function(th) p + get(th)() + ggtitle(th)) | |
pl2 <- lapply(addons, function(th) p + get(th)() + ggtitle(th)) | |
library(gridExtra) | |
library(Cairo) | |
CairoPDF("all_themes.pdf", width=8, height=32) | |
grid.arrange(arrangeGrob(grobs=pl1, top = "Original themes", ncol=2), | |
arrangeGrob(grobs=pl2, top = "Third-party themes", ncol=2), heights=c(0.4, 1)) | |
dev.off() | |
Author
baptiste
commented
Oct 31, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment