[R] Venn diagram with identification numbers

David Winsemius dwinsemius at comcast.net
Fri Feb 21 22:36:23 CET 2014


On Feb 21, 2014, at 11:00 AM, Luigi Marongiu wrote:

> Dear all,
> 
> I would like to draw a Venn plot for data represented by 6 variables. I
> know how to do this using the package venneuler (which requires rJava).
> However this package does not report the numbers of elements within each
> class.
> 

Labeling is already in the VennDiagram package, and I recently answered a question on SO asking to include percentages as well:

http://stackoverflow.com/questions/21715009/adding-percents-to-venn-diagrams-in-r/21717547#21717547

Now admittedly this was only for the set intersections of three sets. The output of `venneuler` is not compatible with that approach, but it does appear that there ir a `draw.quintuple.venn` function in VennDiagram.

-- 
David.

> Do you know how to display the number of elements using either this or
> other packages?
> 
> Best wishes,
> 
> Luigi
> 
> 
> 
>            library(venneuler)
> 
>            library(rJava)
> 
> 
> 
> a<-c(   1,         1,         1,         1,         1,         1,
>   1,
> 1,         1,         1,         1,         1,         1,         1,
> 0,            0,         0,         0,         0,         0,         0,
> 0,         0,         0,         0,         0,         0,         0,
> 0,         0,            0,         0,         0,         0,         0,
> 0,         0,         0,         0,         0,         0,         0,
> 0,         0,         0,            0,         0,         0,         0,
> 0,         0,         0,         0,         0,         0,         0,
> 0,         0,         0,         0,            0,         0,         0,
> 0,         0,         0,         0,         0,         0,         0,
> 0,         0,         0,         0,         0,            0,         0,
> 0,         0,         0,         0,         0,         0,         0,
> 0,         0,         0,         0,         0,         0,            0,
> 0,         0,         0,         0,         0,         0,         0,
> 0,         0,         0,         0,         0,         0,         0)
> 
> b<-c(   0,         0,         0,         0,         0,         0,
>   0,
> 0,         0,         0,         0,         0,         0,         0,
> 1,            1,         1,         1,         1,         1,         1,
> 1,         1,         1,         1,         1,         1,         1,
> 1,         1,            1,         1,         1,         1,         0,
> 0,         0,         0,         0,         0,         0,         0,
> 0,         0,         0,            0,         0,         0,         0,
> 0,         0,         0,         0,         0,         0,         0,
> 0,         0,         0,         0,            0,         0,         0,
> 0,         0,         0,         0,         0,         0,         0,
> 0,         0,         0,         0,         0,            0,         0,
> 0,         0,         0,         0,         0,         0,         0,
> 0,         0,         0,         0,         0,         0,            0,
> 0,         0,         0,         0,         0,         0,         0,
> 0,         0,         0,         0,         0,         0,         0)
> 
> c<-c(   0,         0,         0,         0,         0,         0,
>   0,
> 0,         0,         0,         0,         0,         0,         0,
> 0,            1,         0,         0,         0,         0,         0,
> 0,         0,         0,         0,         0,         0,         0,
> 0,         0,            0,         0,         0,         0,         0,
> 0,         0,         1,         1,         1,         1,         1,
> 1,         1,         1,            1,         1,         1,         1,
> 1,         1,         1,         1,         1,         1,         1,
> 1,         1,         1,         1,            1,         1,         1,
> 0,         0,         0,         0,         0,         0,         0,
> 0,         0,         0,         0,         0,            0,         0,
> 0,         0,         0,         0,         0,         0,         0,
> 0,         0,         0,         0,         0,         0,            0,
> 0,         0,         0,         0,         0,         0,         0,
> 0,         0,         0,         0,         0,         0,         0)
> 
> d<-c(   0,         0,         0,         0,         0,         0,
>   0,
> 0,         0,         0,         0,         0,         0,         0,
> 0,            0,         0,         0,         1,         1,         0,
> 0,         0,         0,         0,         0,         0,         0,
> 0,         0,            0,         0,         0,         0,         0,
> 0,         0,         0,         0,         0,         0,         0,
> 0,         0,         1,            0,         0,         0,         0,
> 0,         0,         0,         0,         0,         0,         0,
> 0,         0,         0,         0,            0,         0,         0,
> 0,         0,         0,         0,         0,         0,         0,
> 0,         0,         0,         0,         0,            0,         1,
> 0,         0,         0,         0,         0,         0,         0,
> 0,         0,         0,         0,         0,         1,            0,
> 0,         0,         0,         0,         0,         0,         0,
> 0,         0,         0,         0,         0,         0,         0)
> 
> e<-c(   1,         1,         1,         0,         0,         0,
>   0,
> 0,         0,         0,         0,         0,         0,         0,
> 1,            1,         0,         1,         0,         0,         1,
> 1,         1,         1,         1,         1,         1,         1,
> 1,         0,            0,         1,         1,         1,         1,
> 1,         1,         1,         1,         1,         0,         0,
> 0,         1,         0,            1,         1,         1,         1,
> 1,         1,         1,         1,         0,         0,         1,
> 1,         1,         1,         0,            0,         0,         0,
> 1,         1,         1,         1,         1,         1,         1,
> 1,         1,         1,         1,         1,            1,         1,
> 1,         1,         1,         1,         1,         1,         1,
> 1,         1,         1,         1,         1,         1,            1,
> 1,         1,         1,         1,         1,         1,         1,
> 1,         1,         1,         1,         1,         1,         0)
> 
> f<-c(    0,         0,         1,         1,         1,         1,
> 1,         1,         1,         1,         1,         1,         1,
> 1,         1,            0,         1,         1,         0,         1,
> 1,         1,         0,         0,         1,         1,         0,
> 1,         0,         1,            1,         1,         1,         0,
> 0,         1,         0,         0,         0,         1,         1,
> 1,         1,         1,         0,            1,         0,         1,
> 0,         0,         1,         0,         1,         1,         1,
> 0,         0,         0,         0,         1,            1,         1,
> 1,         0,         1,         1,         1,         0,         1,
> 0,         0,         1,         1,         0,         0,            1,
> 1,         1,         0,         0,         0,         1,         1,
> 0,         1,         1,         1,         1,         1,         1,
> 0,         0,         1,         1,         1,         1,         1,
> 0,         0,         1,         0,         1,         1,         1,
> 1)
> 
> 
> 
> data<-cbind(a,b,c,d,e,f)
> 
> 
> 
> plot(venneuler(data), main="test")
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA




More information about the R-help mailing list