Search code examples
rvenn-diagram

Adjust the relative positions of Venn diagram using R Venn.diagram package


I would like to draw a Venn Diagram using the R Venn.digram package. Here is my code.

library(VennDiagram)
myCol2 <- brewer.pal(3, "Pastel2")

list1 <- c(1:179)
list2 <- c(171:224)
list3 <- c(1:17, 171, 172, 225:230)

venn.diagram(
  x = list(list1, list2, list3),
  category.names = c("list1", "list2", "list3"),
  filename = 'three comparison.png',
  output=TRUE,
  resolution = 600,
  cex = 1.8,  # size of numbers in the cycles
  # sub.fontfamily = "serif",
  fontfamily ="Arial",
  main.fontfamily="serif",
  cat.cex = 1.2, # size of category names
  fill = myCol2
)

Here is my Venn diagram output. enter image description here

Is there a way to rotate two cycles corresponding to list2 and list3 to make the plot look like the following? - Basically, I don't want three centers on the same line.

enter image description here


Solution

  • Thanks Dominik Rafacz for introducing the ggvenn package. It works.

    library(ggvenn)

    a <- list(list1 = c(1:179),
              list2 = c(171:224),
              list3 = c(1:17, 171, 172, 225:230))
    
    ggvenn(a, c("list1", "list2", "list3"),show_percentage = F)  
    

    enter image description here