Last active
July 17, 2017 23:25
-
-
Save robwschlegel/b042b80c45af6d6ec8d769b3ebb71fbe 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
# Convert the figures to grobs | |
mg_top_grob <- ggplotGrob(mg_top) | |
fb_grob <- ggplotGrob(fb) | |
mg_bottom_grob <- ggplotGrob(mg_bottom) | |
# Stick them together | |
gg <- ggplot() + | |
# First set the x and y axis values so we know what the ranges are | |
# in order to make it easier to place our facets | |
coord_equal(xlim = c(1, 10), ylim = c(1, 10), expand = F) + | |
# Then we place our facetsover one another using the coordinates we created | |
annotation_custom(mg_top_grob, | |
xmin = 1, xmax = 10, ymin = 5.5, ymax = 10) + | |
annotation_custom(fb_grob, | |
xmin = 3.5, xmax = 5.5, ymin = 7.2, ymax = 8.8) + | |
annotation_custom(mg_bottom_grob, | |
xmin = 1, xmax = 10, ymin = 1, ymax = 5.5) | |
# save | |
# DPI set very low because my internet is slow... | |
ggsave(plot = gg, filename = "../figures/mg_full.png", dpi = 100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment