简体   繁体   中英

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. 在此处输入图像描述

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.

在此处输入图像描述

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)  

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM