Question: Need help with creating a Euler diagram from a csv file
gravatar for stoessel
5.7 years ago by
stoessel0 wrote:

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.1k views
ADD COMMENTlink modified 5.6 years ago by brennanpincardiff200 • written 5.7 years ago by stoessel0

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

ADD REPLYlink written 5.7 years ago by Devon Ryan98k
gravatar for brennanpincardiff
5.6 years ago by
United Kingdom
brennanpincardiff200 wrote:

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

ADD COMMENTlink modified 5.6 years ago • written 5.6 years ago by brennanpincardiff200
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1865 users visited in the last hour