Last active
February 13, 2019 09:31
-
-
Save gtuckerkellogg/68d5490e1e13fc6e9ed1689b1bd33dbd to your computer and use it in GitHub Desktop.
a patchwork of images and ggplot output
This file contains hidden or 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
if (!('patchwork' %in% rownames(installed.packages()))) { | |
devtools::install_github('thomasp85/patchwork') | |
} | |
if (!('magick' %in% rownames(installed.packages()))) { | |
install.packages('magick') | |
} | |
if (!('cowplot' %in% rownames(installed.packages()))) { | |
install.packages('cowplot') | |
} | |
library(patchwork) | |
p1 <- ggplot(mtcars) + geom_point(aes(mpg, disp)) | |
p2 <- ggplot(mtcars) + geom_boxplot(aes(gear, disp, group = gear)) | |
p1 + p2 + plot_annotation(tag_levels='A') & cowplot::theme_cowplot() | |
library(magick) | |
p3 <- image_ggplot(logo) | |
{ p1 + p2 & cowplot::theme_cowplot() } + p3 + plot_annotation(tag_levels='A') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment