Need help with creating a Euler diagram from a csv file
Entering edit mode
6.4 years ago
stoessel • 0

Hello, I'm pretty new in the R community and I would like to learn how to make a euler diagram (venn diagram) in R. I would like to read the data from a csv and process the data by rows, for example row 1-3 are the three different groups I would like to compare. It would be great to get a euler diagram with the name, number of elements and also element dependent sizes of the circles. Could somebody please help me with setting up such a script? It would be really helpful to learn how to read certain csv files and also how to set up a nice venn diagram.



R • 2.4k views
Entering edit mode

Have a look at the VennDiagram package and let us know if you have trouble with that.

Entering edit mode
6.4 years ago

The VennDiagram package is very useful for making and preparing VennDiagrams but you have to know the values of the overlaps. It will make Venn and Euler Diagrams. 

To calculate the overlaps between your groups you can download other packages but it's actually pretty simple with normal R code. 

The intersect() function will give you the number of elements that are the same in two vectors. 

The setdiff() function will give you the number of elements in one vector but not the other. 

These are all detailed in the Set Operation page and there is a useful StackOverload answer too. 

So the basic script you need to write has the following elements:

(1) Read in the csv file - function - read.csv()

(2) Turn your data into three vectors - function - as.vector() 

(3) Compare your sets using the intersect() and setdiff() functions. 

(4) Draw your Venn or Euler diagram with the VennDiagram package


If you want to use a package to give you the overlaps from the lists you can try gplots (

I have written a script about comparing two protein lists that is a simplified version of what you're trying to do.

I hope this helps. Good luck, P


Login before adding your answer.

Traffic: 1365 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6