Created
September 20, 2021 17:19
-
-
Save millerh1/159efba59bd60fbe8356d6b14dddc729 to your computer and use it in GitHub Desktop.
Tidy venn.diagram
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(magrittr) | |
# Venn diagram plot in tidy pipe | |
plt <- list( | |
"A" = 1:100, | |
"B" = 96:140 | |
) %>% | |
VennDiagram::venn.diagram(filename = NULL) %>% | |
grid::grid.draw(.) %>% | |
ggplotify::grid2grob() %>% | |
ggplotify::as.ggplot() | |
# Plot is stored in ggplot object | |
plt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This gist shows how you can create a
venn.diagram()
as part of a tidy pipe and store it in a ggplot2 object. This can be useful in situations where you need to storevenn.diagram()
objects for later use or with ggplot-specific functions likeggpubr::ggarrange()