Skip to content

Instantly share code, notes, and snippets.

@gtuckerkellogg
Last active February 13, 2019 09:31
Show Gist options
  • Save gtuckerkellogg/68d5490e1e13fc6e9ed1689b1bd33dbd to your computer and use it in GitHub Desktop.
Save gtuckerkellogg/68d5490e1e13fc6e9ed1689b1bd33dbd to your computer and use it in GitHub Desktop.
a patchwork of images and ggplot output
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