Search code examples
rggplot2venn-diagram

Euler diagram in R


Hello every one I wanted to plot a Euler diagram, but what I am expecting to plot in a different way which is looking as below. how can I plot this type Euler diagram any suggestions, is it possible to plot like this

Thank you

  A  B  C  D   A1   B1   C1   D1
  2  3  5  6   2   30   30   60
  3  0  1  2   4   50   10   10
  4  0  6  5   85   4   85   50
  6  0  10 4   90  70   90    4
  5  92 50 10  50  50    3   30

enter image description here


Solution

  • As explained in the comments, you will not be able to express an arbitrary set of relationships for more than 3 sets with circles. The package eulerr uses ellipses to get more combinations and also make the result somewhat proportional to the number of elements in each region. I made a different package called nVennR that uses circles for the regions instead of the sets. The sets are then drawn around those circles:

    > library(nVennR)
    > myT <- read.table('clipboard', header = T)
    > lol <- as.list(myT)
    > myV <- plotVenn(lol)
    > myV <- plotVenn(nVennObj = myV)
    > myV <- plotVenn(nVennObj = myV)
    > myV <- plotVenn(nVennObj = myV)
    > myV <- plotVenn(nVennObj = myV)
    > myV <- plotVenn(nVennObj = myV)
    > myV <- showSVG(nVennObj = myV, opacity = 0.2)
    

    Repeating the command myV <- plotVenn(nVennObj = myV) is necessary to get a compact shape. If you try it, you will see that it takes a couple of minutes, as it needs to perform several simulations. The package can take any number of sets, but things get really slow above 9 sets. The result:

    Euler diagram

    You can save, edit and improve the picture to better show the information, but it is not trivial. You can find more information in the vignette.