Skip to content

Instantly share code, notes, and snippets.

@millerh1
Created September 20, 2021 17:19
Show Gist options
  • Save millerh1/159efba59bd60fbe8356d6b14dddc729 to your computer and use it in GitHub Desktop.
Save millerh1/159efba59bd60fbe8356d6b14dddc729 to your computer and use it in GitHub Desktop.
Tidy venn.diagram
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
@millerh1
Copy link
Author

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 store venn.diagram() objects for later use or with ggplot-specific functions like ggpubr::ggarrange()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment