A Venn diagram shows all possible logical relations between several sets of data.

If we consider 3 lists of things for 3 distinct populations like in this figure, it is interesting to know how many things are common between each couple !

This figure is done with the Venn diagram package. I still don’t know how to make the area sizes proportional to the length of each list, please tell me if you do !

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
#upload library library(VennDiagram) #Then generate 3 sets of words.There I generate 3 times 200 SNPs names. SNP_pop_1=paste(rep("SNP_" , 200) , sample(c(1:1000) , 200 , replace=F) , sep="") SNP_pop_2=paste(rep("SNP_" , 200) , sample(c(1:1000) , 200 , replace=F) , sep="") SNP_pop_3=paste(rep("SNP_" , 200) , sample(c(1:1000) , 200 , replace=F) , sep="") #The goal of the Venn Diagram is to count how many words are common between SNP_pop_1 and SNP_pop_2, between SNP_pop_1 and SNP_pop_3 and so on... #The venn.diagram function do it automatically and draw it! (you will get a png file in your current working directory) venn.diagram( x = list(SNP_pop_1 , SNP_pop_2 , SNP_pop_3), category.names = c("SNP pop 1" , "SNP pop 2 " , "SNP pop 3"), filename = '#14_venn_diagramm.png', output = TRUE , imagetype="png" , height = 480 , width = 480 , resolution = 300, compression = "lzw", lwd = 2, lty = 'blank', fill = c('yellow', 'purple', 'green'), cex = 1, fontface = "bold", fontfamily = "sans", cat.cex = 0.6, cat.fontface = "bold", cat.default.pos = "outer", cat.pos = c(-27, 27, 135), cat.dist = c(0.055, 0.055, 0.085), cat.fontfamily = "sans", rotation = 1 ) |

*Not what you are looking for ? Make a new search !*

Hi,

I am trying the same for the four set of words, which part of the code should i change for the 4 way wen diagram.

thanks

Hi Vikram S,

I do not advise to make a Venn Diagram with more than 3 groups, it makes the figure really hard to read.

However, the page 7 of the package documentation will probably help you to answer your question: https://cran.r-project.org/web/packages/VennDiagram/VennDiagram.pdf.

Best,

Yan