Tan Hui Hui Jenny
2005-Jun-09 00:15 UTC
[R] How to plot more than 3 sets in Venn Diagrams?
I'm trying to plot Venn diagrams with more than 3 sets (5 actually) in order to describe graphically the genetic variation between populations. I tried the limma library but realised it can only plot 3 sets. Is there any solution? Of course I could plot the chart manually but it'll take too long (have other datasets)..... One of my dataset is given below. THanks for any advice. j AA CH EA IN MY [1,] 0 0 0 1 0 [2,] 1 0 0 0 0 [3,] 1 0 0 0 0 [4,] 0 0 0 0 1 [5,] 1 0 0 0 0 [6,] 1 0 0 0 0 [7,] 1 0 0 0 0 [8,] 1 0 0 1 0 [9,] 1 0 0 0 0 [10,] 1 0 0 0 0 [11,] 1 0 0 0 0 [12,] 0 0 0 0 1 [13,] 1 0 0 0 0 [14,] 0 0 1 0 0 [15,] 1 0 0 0 0 [16,] 0 0 1 0 0 [17,] 1 0 0 0 0 [18,] 0 0 0 1 0 [19,] 1 0 0 1 0 [20,] 0 0 1 0 0 [21,] 0 1 0 0 0 [22,] 1 0 0 0 0 [23,] 0 0 1 0 0 [24,] 1 0 1 1 1 [25,] 0 1 0 0 0 [26,] 1 0 0 0 0 [27,] 1 0 0 0 0 [28,] 0 0 0 1 0 [29,] 0 0 0 1 0 [30,] 1 0 0 0 0 [31,] 1 0 0 0 0 [32,] 0 0 0 1 0 [33,] 0 0 0 1 0 [34,] 0 1 0 0 0 [35,] 1 0 0 0 0 [36,] 0 0 0 1 0 [37,] 0 0 1 1 0 [38,] 1 0 0 1 0 [39,] 0 0 0 1 0 [40,] 0 0 0 1 0 [41,] 0 1 0 0 0 [42,] 1 0 0 0 0 [43,] 0 0 0 1 0 [44,] 0 0 1 0 0 [45,] 1 0 0 0 0 [46,] 1 0 0 0 0 [47,] 0 0 0 1 0 [48,] 1 0 0 0 0 [49,] 0 0 0 1 0 [50,] 0 0 1 0 0 [51,] 0 0 0 1 0 [52,] 1 0 0 0 0 [53,] 0 0 0 1 0 [54,] 1 0 0 0 0 [55,] 0 1 0 0 0
Tan Hui Hui Jenny wrote:> I'm trying to plot Venn diagrams with more than 3 sets (5 actually) in order to describe graphically the genetic variation between populations. > > I tried the limma library but realised it can only plot 3 sets. > > Is there any solution? Of course I could plot the chart manually but it'll take too long (have other datasets)..... One of my dataset is given below.The general Venn diagrams with more than 3 sets are ugly. You can't use circles, you need strange shapes to get all the 2^n-1 possible subsets. Duncan Murdoch
Gabor Grothendieck
2005-Jun-09 03:10 UTC
[R] How to plot more than 3 sets in Venn Diagrams?
If the data you posted is prototypical of your datasets then note that: - it has two disconnected components of 1 and 4 sets - there are only 8 unique rows out of 32 - 5 of these 8 are the regions that contain only the non-intersecting portion of each of the 5 sets> unique(mydata)AA CH EA IN MY 1 0 0 0 1 0 2 1 0 0 0 0 4 0 0 0 0 1 8 1 0 0 1 0 14 0 0 1 0 0 21 0 1 0 0 0 24 1 0 1 1 1 37 0 0 1 1 0 Thus these are not very interesting Venn diagrams as they are quite sparse. Perhaps you would be better off to represent them as bipartite graphs with a node for each row and a node for each column with the edges corresponding to the ones. The RGraphViz package (or graphViz, itself, locatable via google) could be used for that. On 6/8/05, Tan Hui Hui Jenny <medp9193 at nus.edu.sg> wrote:> I'm trying to plot Venn diagrams with more than 3 sets (5 actually) in order to describe graphically the genetic variation between populations. > > I tried the limma library but realised it can only plot 3 sets. > > Is there any solution? Of course I could plot the chart manually but it'll take too long (have other datasets)..... One of my dataset is given below. > > THanks for any advice. > > j > > AA CH EA IN MY > [1,] 0 0 0 1 0 > [2,] 1 0 0 0 0 > [3,] 1 0 0 0 0 > [4,] 0 0 0 0 1 > [5,] 1 0 0 0 0 > [6,] 1 0 0 0 0 > [7,] 1 0 0 0 0 > [8,] 1 0 0 1 0 > [9,] 1 0 0 0 0 > [10,] 1 0 0 0 0 > [11,] 1 0 0 0 0 > [12,] 0 0 0 0 1 > [13,] 1 0 0 0 0 > [14,] 0 0 1 0 0 > [15,] 1 0 0 0 0 > [16,] 0 0 1 0 0 > [17,] 1 0 0 0 0 > [18,] 0 0 0 1 0 > [19,] 1 0 0 1 0 > [20,] 0 0 1 0 0 > [21,] 0 1 0 0 0 > [22,] 1 0 0 0 0 > [23,] 0 0 1 0 0 > [24,] 1 0 1 1 1 > [25,] 0 1 0 0 0 > [26,] 1 0 0 0 0 > [27,] 1 0 0 0 0 > [28,] 0 0 0 1 0 > [29,] 0 0 0 1 0 > [30,] 1 0 0 0 0 > [31,] 1 0 0 0 0 > [32,] 0 0 0 1 0 > [33,] 0 0 0 1 0 > [34,] 0 1 0 0 0 > [35,] 1 0 0 0 0 > [36,] 0 0 0 1 0 > [37,] 0 0 1 1 0 > [38,] 1 0 0 1 0 > [39,] 0 0 0 1 0 > [40,] 0 0 0 1 0 > [41,] 0 1 0 0 0 > [42,] 1 0 0 0 0 > [43,] 0 0 0 1 0 > [44,] 0 0 1 0 0 > [45,] 1 0 0 0 0 > [46,] 1 0 0 0 0 > [47,] 0 0 0 1 0 > [48,] 1 0 0 0 0 > [49,] 0 0 0 1 0 > [50,] 0 0 1 0 0 > [51,] 0 0 0 1 0 > [52,] 1 0 0 0 0 > [53,] 0 0 0 1 0 > [54,] 1 0 0 0 0 > [55,] 0 1 0 0 0
davidr@rhotrading.com
2005-Jun-09 14:53 UTC
[R] How to plot more than 3 sets in Venn Diagrams?
Here is a link to see what's possible. http://www.combinatorics.org/Surveys/ds5/VennSymmEJC.html Venn did 4 sets with ellipses (see wikipedia.) (There was an article in the last year (I think) in one of my math journals that presented someone who made these complex Venn diagrams as artwork and sold, but I can't remember the person's name right now.) HTH David L. Reiner -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Tan Hui Hui Jenny Sent: Wednesday, June 08, 2005 7:16 PM To: r-help at stat.math.ethz.ch Subject: [R] How to plot more than 3 sets in Venn Diagrams? I'm trying to plot Venn diagrams with more than 3 sets (5 actually) in order to describe graphically the genetic variation between populations. I tried the limma library but realised it can only plot 3 sets. Is there any solution? Of course I could plot the chart manually but it'll take too long (have other datasets)..... One of my dataset is given below. THanks for any advice. j AA CH EA IN MY [1,] 0 0 0 1 0 [2,] 1 0 0 0 0 [3,] 1 0 0 0 0 [4,] 0 0 0 0 1 [5,] 1 0 0 0 0 [6,] 1 0 0 0 0 [7,] 1 0 0 0 0 [8,] 1 0 0 1 0 [9,] 1 0 0 0 0 [10,] 1 0 0 0 0 [11,] 1 0 0 0 0 [12,] 0 0 0 0 1 [13,] 1 0 0 0 0 [14,] 0 0 1 0 0 [15,] 1 0 0 0 0 [16,] 0 0 1 0 0 [17,] 1 0 0 0 0 [18,] 0 0 0 1 0 [19,] 1 0 0 1 0 [20,] 0 0 1 0 0 [21,] 0 1 0 0 0 [22,] 1 0 0 0 0 [23,] 0 0 1 0 0 [24,] 1 0 1 1 1 [25,] 0 1 0 0 0 [26,] 1 0 0 0 0 [27,] 1 0 0 0 0 [28,] 0 0 0 1 0 [29,] 0 0 0 1 0 [30,] 1 0 0 0 0 [31,] 1 0 0 0 0 [32,] 0 0 0 1 0 [33,] 0 0 0 1 0 [34,] 0 1 0 0 0 [35,] 1 0 0 0 0 [36,] 0 0 0 1 0 [37,] 0 0 1 1 0 [38,] 1 0 0 1 0 [39,] 0 0 0 1 0 [40,] 0 0 0 1 0 [41,] 0 1 0 0 0 [42,] 1 0 0 0 0 [43,] 0 0 0 1 0 [44,] 0 0 1 0 0 [45,] 1 0 0 0 0 [46,] 1 0 0 0 0 [47,] 0 0 0 1 0 [48,] 1 0 0 0 0 [49,] 0 0 0 1 0 [50,] 0 0 1 0 0 [51,] 0 0 0 1 0 [52,] 1 0 0 0 0 [53,] 0 0 0 1 0 [54,] 1 0 0 0 0 [55,] 0 1 0 0 0 ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> Message: 23 > Date: Thu, 9 Jun 2005 09:53:02 -0500 > From: <davidr at rhotrading.com> > Subject: RE: [R] How to plot more than 3 sets in Venn Diagrams? > To: "Tan Hui Hui Jenny" <medp9193 at nus.edu.sg>, > <r-help at stat.math.ethz.ch> > Message-ID: > <12AE52872B5C5348BE5CF47C707FF53A5FB672 at rhosvr02.rhotrading.com> > Content-Type: text/plain; charset="us-ascii" > > Here is a link to see what's possible. > http://www.combinatorics.org/Surveys/ds5/VennSymmEJC.html > > Venn did 4 sets with ellipses (see wikipedia.) > > (There was an article in the last year (I think) in one of my math > journals that presented someone who made these complex Venn diagrams as > artwork and sold, but I can't remember the person's name right now.)The book is Cogwheels of the Mind : The Story of Venn Diagrams by A. W. F. Edwards (foreword by Ian Stewart) Hardcover: 136 pages Publisher: The Johns Hopkins University Press (April 26, 2004) ISBN: 0801874343 It is a really beautiful book. There are also some journal articles on the subject by Edwards and by Branko Grunbaum (http://www.math.washington.edu/~grunbaum/BG228.pdf) Edwards is my intellectual grandfather (thesis advisor's thesis advisor), and it is a pleasure to recommend this book. (A bit irrelevant to R, I know, but still ...)
Tan Hui Hui Jenny wrote:> I'm trying to plot Venn diagrams with more than 3 sets (5 actually) in order to describe graphically the genetic variation between populations. > > I tried the limma library but realised it can only plot 3 sets. > > Is there any solution? Of course I could plot the chart manually but it'll take too long (have other datasets)..... One of my dataset is given below. >Hi Jenny, Best I could do is four sets. The code is a bit rough but consistent with the vennDiagram function in the limma package. Jim -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: venn4.R Url: https://stat.ethz.ch/pipermail/r-help/attachments/20050610/7255c49f/venn4.pl