How to create a venn diagram?

I have following data need to be visualized by a venn diagram
Total counts: 1668
Counts for group A: 62
Counts for group B: 24 (Group B is a subgroup of group A, all counts in group B are included in group A)
Counts for group C: 267 (including group A, but excluded group B)

How to display the proportion(%) of overlap between each other by venn diagram? request the graph display 4 ways (total, group A, B, C). Thank you!

There's a VennDiagram package you can use.

Here are a few walk-through tutorials:
http://www.di.fc.ul.pt/~jpn/r/GraphicalTools/Venn.html

https://rstudio-pubs-static.s3.amazonaws.com/13301_6641d73cfac741a59c0a851feb99e98b.html

https://stats.idre.ucla.edu/r/faq/how-can-i-generate-a-venn-diagram-in-r/

1 Like

Thank you! Mara,

I created following code for 3 ways, it works:
grid.newpage()
venn.plot <- draw.triple.venn(area1 = 3.7,
area2 = 1.4,
area3 = 16.1,
n12 = 1.4,
n23 = 0,
n13 = 2.3,
n123 = 0,
category = c('A', 'B', 'C'),
fill = c('red', 'blue', 'green'),
cat.col = c('red', 'blue', 'green'),
cex = c(1/2,2/2,3/2,4/2,5/2,6/2,7/2),
cat.cex = c(1,2,3),
euler = TRUE,
scaled = F
)

But, I am trying to create a chart for 4 ways, what function I should use? draw.quadruple.venn ?
it doesn't work.
grid.newpage()
venn.plot <- draw.triple.venn(area1 = 100,
area2 = 3.7,
area3 = 1.4,
area4 = 16.1
n12 = 3.7,
n13 = 1.4
n14 = 16.1
n23 = 1.4,
n24 = 2.3
n123 = 1.4,
n1234 =0,
category = c('A', 'B', 'C', 'D'),
fill = c('red', 'blue', 'green', 'darkorange1'),
cat.col = c('red', 'blue', 'green', 'darkorange1'),
cex = c(1/2,2/2,3/2,4/2,5/2,6/2,7/2),
cat.cex = c(1,2,3),
euler = TRUE,
scaled = F
)

From looking at the documentation for the VennDiagram package, it looks like the function is draw.quad.venn()

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.