Euler diagram with eulerr in R

1.3k views Asked by At

I'm trying to plot a Venn diagram using the eulerr package in R.

library(eulerr)

vd <- euler(c("gen"=7,"RC"=1,"PP"=2,"Mixed"=5,"None"=12,"gen&PP"=30,
          "gen&PP&RC"=6,"PP&RC"=2,"gen&RC"=6),
        shape="circle");

Inspecting the value of the vd object I get

                     original fitted residuals regionError
gen                         7  7.690    -0.690       0.008
RC                          1  1.482    -0.482       0.006
PP                          2  2.327    -0.327       0.004
Mixed                       5  5.172    -0.172       0.001
None                       12 12.412    -0.412       0.003
gen&RC                      6  5.641     0.359       0.006
gen&PP                     30 30.942    -0.942       0.007
gen&Mixed                   0  0.000     0.000       0.000
gen&None                    0  0.000     0.000       0.000
RC&PP                       2  0.000     2.000       0.028
RC&Mixed                    0  0.000     0.000       0.000
RC&None                     0  0.000     0.000       0.000
PP&Mixed                    0  0.000     0.000       0.000
PP&None                     0  0.000     0.000       0.000
Mixed&None                  0  0.000     0.000       0.000
gen&RC&PP                   6  6.387    -0.387       0.004
gen&RC&Mixed                0  0.000     0.000       0.000
gen&RC&None                 0  0.000     0.000       0.000
gen&PP&Mixed                0  0.000     0.000       0.000
gen&PP&None                 0  0.000     0.000       0.000
gen&Mixed&None              0  0.000     0.000       0.000
RC&PP&Mixed                 0  0.000     0.000       0.000
RC&PP&None                  0  0.000     0.000       0.000
RC&Mixed&None               0  0.000     0.000       0.000
PP&Mixed&None               0  0.000     0.000       0.000
gen&RC&PP&Mixed             0  0.000     0.000       0.000
gen&RC&PP&None              0  0.000     0.000       0.000
gen&RC&Mixed&None           0  0.000     0.000       0.000
gen&PP&Mixed&None           0  0.000     0.000       0.000
RC&PP&Mixed&None            0  0.000     0.000       0.000
gen&RC&PP&Mixed&None        0  0.000     0.000       0.000

diagError: 0.028 
stress:    0.004 

So as the fitted value of RC&PP is 0.000, it doesn't appear in the final plot result. Is it possible to modify this value so the intersection appears in the graph?

1

There are 1 answers

0
vqf On

That problem looks similar to this one. As Johan Larsson states, this kind of problem is hard for the eulerr algorithm. If you want to give nVennR a try, you can:

> library(nVennR)
> myV <- createVennObj(nSets = 5, sNames = c("gen","RC","PP","Mixed","None"))
> myV <- setVennRegion(myV, c("gen"), 7)
> myV <- setVennRegion(myV, c("RC"), 1)
> myV <- setVennRegion(myV, c("PP"), 2)
> myV <- setVennRegion(myV, c("Mixed"), 5)
> myV <- setVennRegion(myV, c("None"), 12)
> myV <- setVennRegion(myV, c("gen", "PP"), 30)
> myV <- setVennRegion(myV, c("gen", "PP", "RC"), 6)
> myV <- setVennRegion(myV, c("PP", "RC"), 2)
> myV <- setVennRegion(myV, c("gen", "RC"), 6)
> myV <- plotVenn(nVennObj = myV)
> myV <- plotVenn(nVennObj = myV)
> myV <- plotVenn(nVennObj = myV) 

The last command is repeated on purpose to compact the result:

Euler diagram

You can check the vignette for more info.