Closed vertesy closed 2 years ago
Draw Venn or Euler diagramms with ggExpress Alternative of MarkdownReports::wvenn()
MarkdownReports::wvenn()
From Trinker's Gist
if (!require("pacman")) install.packages("pacman") pacman::p_load(dplyr, venneuler) pacman::p_load_current_gh('trinker/textshape', 'thomasp85/ggforce') x <- matrix(sample(0:4, 80, TRUE, c(.6, .1, .1, .1, .1)), ncol=4) colnames(x) <- LETTERS[1:4] euler_dat <- split(as.data.frame(x), c(T, F)) %>% setNames( c('dog', 'cat')) %>% lapply(function(x){ rownames(x) <- letters[1:10]; x}) %>% lapply(function(x){ y <- venneuler(x) data.frame(y$centers, diameters = y$diameters, labels = y$labels, stringsAsFactors = FALSE) }) %>% textshape::bind_list('animal') euler_dat %>% mutate(r = diameters/2) %>% ggplot() + geom_circle(aes(x0 = x, y0 = y, r = r, fill=labels), alpha = .5) + facet_wrap(~animal) + geom_text(aes(x = x, y = y, label = labels)) + coord_fixed()
Output
https://www.datanovia.com/en/blog/beautiful-ggplot-venn-diagram-with-r/
Venn diagramm now implemented!
Draw Venn or Euler diagramms with ggExpress Alternative of
MarkdownReports::wvenn()
From Trinker's Gist
Output
Output