VennDiagram - internal labels

user1732190 picture user1732190 · Oct 9, 2012 · Viewed 13.9k times · Source

enter image description hereI plotted my genelists using the VennDiagram R package, and the diagram looks fine.

I wanted to add internal labels to the Venn diagram like, if data is shared by first and second group but not by the third and fourth group, then the label should be 1100. I found one thing on Venn{gplots} package which uses the showSetLogicLabel=TRUE to do this.

I am searching exactly for the same functionality, but using the VennDiagram package.

Exactly, like in the below picture, which gives binary codes to every count in the diagram. I wanted to generate that binary codes in the VennDiagram package.

http://rgm2.lab.nig.ac.jp/RGM_results/gplots:venn/venn_016_big.png

Answer

Ali picture Ali · Oct 9, 2012

Try this:

library(VennDiagram)
draw.triple.venn(65, 75, 85, 35, 15, 25, 5, c("First", "Second", "Third"))

3 Groups Venn Diagram

Or this for a nicer view, and 4 groups:

A <- sample(1:1000, 400, replace = FALSE); 
B <- sample(1:1000, 600, replace = FALSE);
C <- sample(1:1000, 350, replace = FALSE);
D <- sample(1:1000, 550, replace = FALSE);
E <- sample(1:1000, 375, replace = FALSE);
venn.diagram(x = list(A = A,D = D,B = B,C = C), filename = "Venn.tiff",
col = "transparent", fill = c("cornflowerblue","green","yellow","darkorchid1"),
alpha = 0.50, label.col = c("orange", "white", "darkorchid4", "white", "white", 
"white",    "white", "white", "darkblue", "white", "white", "white", "white", 
"darkgreen", "white"), cex = 1.5, fontfamily = "serif", fontface = "bold",
cat.col = c("darkblue", "darkgreen", "orange", "darkorchid4"), cat.cex = 1.5,
cat.pos = 0, cat.dist = 0.07, cat.fontfamily = "serif", rotation.degree = 270,
margin = 0.2)

4 Groups Venn Diagram

There are plenty of more examples in the VennDiagram Document (Here)