Creating a Venn Diagram with 4 sets
2
0
Entering edit mode
@lcarvalhbtkfi-5223
Last seen 10.2 years ago
I am trying to create a Venn diagram for this data, and the Venn diagram needs to show the number of occurring cases of each different intersection, for example in the diagram section were c1,c2 intersect each other should be the value 13. Data: c1 c2 c3 c4 Counts [1,] 0 0 0 0 26 [2,] 0 0 0 1 27 [3,] 0 0 1 0 4 [4,] 0 0 1 1 6 [5,] 0 1 0 0 5 [6,] 0 1 0 1 12 [7,] 0 1 1 0 42 [8,] 0 1 1 1 78 [9,] 1 0 0 0 18 [10,] 1 0 0 1 52 [11,] 1 0 1 0 4 [12,] 1 0 1 1 63 [13,] 1 1 0 0 13 [14,] 1 1 0 1 47 [15,] 1 1 1 0 88 [16,] 1 1 1 1 182 I have been trying to use the package VennDiagram, with the function venn.diagram. But I am only able to get some of the values correct in the diagram. Can anyone give me some help? maybe some other way of making a nice looking venn diagram? or help me correcting this code so that I can produce the correct venn diagram? Code: library (VennDiagram) library(grid) venn.diagram( x = list( comp1=c(1:18, 19:31, 32:119, 120:123, 124:186, 187:238, 239:420, 421:467), comp4=c(692:695,561:603,472:560,120:123, 187:238, 239:420, 603:681,682:688), comp2=c(468:472,19:31, 32:119, 239:420, 421:467, 561:602, 603:680, 681:6918), comp3=c(780:807,716:779,603:680,681:691, 239:420, 421:467, 124:186, 187:238) ), filename = "quadruple_Venn.tiff", col = "black", lty = "dotted", lwd = 4, fill = c("cornflowerblue", "green", "yellow", "darkorchid1"), alpha = 0.50, label.col = c("orange", "white", "darkorchid4", "white", "white", "white", "white", "white", "darkblue", "white", "white", "white", "white", "darkgreen", "white"), cex = 2.5, fontfamily = "serif", fontface = "bold", cat.col = c("darkblue", "darkgreen", "orange", "darkorchid4"), cat.cex = 2.5, cat.fontfamily = "serif" );
• 5.1k views
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 2 days ago
United States
Hi Whomever, Three things. First, VennDiagram isn't a BioC package, so this isn't the correct list for this question. You would be better off on R-help, or directly contacting the author of that package. Second, anonymous posts tend to bring out the less civilized nature of man. If you choose not to identify yourself, it is less likely you will get a response, and if you do get a response it will likely be more terse and possibly rude than if you had identified yourself. Third, the data you show in your matrix are not the same as what you get from the list (x) you use in your call to venn.diagram(). How did you decide to construct the list (x), and why did you think it would give you the same results as in your data structure? When you re-post on R-help, you should at least show how you arrived at your data matrix, and explain why you think the list you pass to venn.diagram() should give identical results. Best, Jim On 4/13/2012 4:02 AM, lcarvalh at btk.fi wrote: > I am trying to create a Venn diagram for this data, and the Venn diagram needs > to show the number of occurring cases of each different intersection, for > example in the diagram section were c1,c2 intersect each other should be the > value 13. > > Data: > > c1 c2 c3 c4 Counts > [1,] 0 0 0 0 26 > [2,] 0 0 0 1 27 > [3,] 0 0 1 0 4 > [4,] 0 0 1 1 6 > [5,] 0 1 0 0 5 > [6,] 0 1 0 1 12 > [7,] 0 1 1 0 42 > [8,] 0 1 1 1 78 > [9,] 1 0 0 0 18 > [10,] 1 0 0 1 52 > [11,] 1 0 1 0 4 > [12,] 1 0 1 1 63 > [13,] 1 1 0 0 13 > [14,] 1 1 0 1 47 > [15,] 1 1 1 0 88 > [16,] 1 1 1 1 182 > > I have been trying to use the package VennDiagram, with the function > venn.diagram. But I am only able to get some of the values correct in the > diagram. Can anyone give me some help? maybe some other way of making a nice > looking venn diagram? or help me correcting this code so that I can produce the > correct venn diagram? > > Code: > > > library (VennDiagram) > library(grid) > > venn.diagram( > x = list( > comp1=c(1:18, 19:31, 32:119, 120:123, 124:186, 187:238, 239:420, > 421:467), > > comp4=c(692:695,561:603,472:560,120:123, 187:238, 239:420, 603:681,682:688), > comp2=c(468:472,19:31, 32:119, 239:420, 421:467, 561:602, 603:680, 681:6918), > comp3=c(780:807,716:779,603:680,681:691, 239:420, 421:467, 124:186, > 187:238) ), > filename = "quadruple_Venn.tiff", > col = "black", > lty = "dotted", > lwd = 4, > fill = c("cornflowerblue", "green", "yellow", "darkorchid1"), > alpha = 0.50, > label.col = c("orange", "white", "darkorchid4", "white", "white", "white", > "white", "white", "darkblue", "white", "white", "white", "white", "darkgreen", > "white"), > cex = 2.5, > fontfamily = "serif", > fontface = "bold", > cat.col = c("darkblue", "darkgreen", "orange", "darkorchid4"), > cat.cex = 2.5, > cat.fontfamily = "serif" > ); > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- James W. MacDonald, M.S. Biostatistician University of Washington Environmental and Occupational Health Sciences 4225 Roosevelt Way NE, # 100 Seattle WA 98105-6099
ADD COMMENT
0
Entering edit mode
Hi, vennDiagram can use up to 3 sets, it can't use for 4 sets. You can use online tool Venny (use up to 4 set, also produce good quality image) : http://bioinfogp.cnb.csic.es/tools/venny/index.html for Venn diagram plot. Hope that Venny can help you. Thanks Nitish On Fri, Apr 13, 2012 at 8:25 AM, James W. MacDonald <jmacdon@uw.edu> wrote: > Hi Whomever, > > Three things. > > First, VennDiagram isn't a BioC package, so this isn't the correct list > for this question. You would be better off on R-help, or directly > contacting the author of that package. > > Second, anonymous posts tend to bring out the less civilized nature of > man. If you choose not to identify yourself, it is less likely you will get > a response, and if you do get a response it will likely be more terse and > possibly rude than if you had identified yourself. > > > Third, the data you show in your matrix are not the same as what you get > from the list (x) you use in your call to venn.diagram(). How did you > decide to construct the list (x), and why did you think it would give you > the same results as in your data structure? When you re-post on R-help, you > should at least show how you arrived at your data matrix, and explain why > you think the list you pass to venn.diagram() should give identical results. > > Best, > > Jim > > > > On 4/13/2012 4:02 AM, lcarvalh@btk.fi wrote: > >> I am trying to create a Venn diagram for this data, and the Venn diagram >> needs >> to show the number of occurring cases of each different intersection, for >> example in the diagram section were c1,c2 intersect each other should be >> the >> value 13. >> >> Data: >> >> c1 c2 c3 c4 Counts >> [1,] 0 0 0 0 26 >> [2,] 0 0 0 1 27 >> [3,] 0 0 1 0 4 >> [4,] 0 0 1 1 6 >> [5,] 0 1 0 0 5 >> [6,] 0 1 0 1 12 >> [7,] 0 1 1 0 42 >> [8,] 0 1 1 1 78 >> [9,] 1 0 0 0 18 >> [10,] 1 0 0 1 52 >> [11,] 1 0 1 0 4 >> [12,] 1 0 1 1 63 >> [13,] 1 1 0 0 13 >> [14,] 1 1 0 1 47 >> [15,] 1 1 1 0 88 >> [16,] 1 1 1 1 182 >> >> I have been trying to use the package VennDiagram, with the function >> venn.diagram. But I am only able to get some of the values correct in the >> diagram. Can anyone give me some help? maybe some other way of making a >> nice >> looking venn diagram? or help me correcting this code so that I can >> produce the >> correct venn diagram? >> >> Code: >> >> >> library (VennDiagram) >> library(grid) >> >> venn.diagram( >> x = list( >> comp1=c(1:18, 19:31, 32:119, 120:123, 124:186, 187:238, >> 239:420, >> 421:467), >> >> comp4=c(692:695,561:603,472:**560,120:123, 187:238, >> 239:420, 603:681,682:688), >> comp2=c(468:472,19:31, 32:119, 239:420, 421:467, 561:602, >> 603:680, 681:6918), >> comp3=c(780:807,716:779,603:**680,681:691, 239:420, >> 421:467, 124:186, >> 187:238) ), >> filename = "quadruple_Venn.tiff", >> col = "black", >> lty = "dotted", >> lwd = 4, >> fill = c("cornflowerblue", "green", "yellow", "darkorchid1"), >> alpha = 0.50, >> label.col = c("orange", "white", "darkorchid4", "white", "white", >> "white", >> "white", "white", "darkblue", "white", "white", "white", "white", >> "darkgreen", >> "white"), >> cex = 2.5, >> fontfamily = "serif", >> fontface = "bold", >> cat.col = c("darkblue", "darkgreen", "orange", "darkorchid4"), >> cat.cex = 2.5, >> cat.fontfamily = "serif" >> ); >> >> ______________________________**_________________ >> Bioconductor mailing list >> Bioconductor@r-project.org >> https://stat.ethz.ch/mailman/**listinfo/bioconductor<https: stat.e="" thz.ch="" mailman="" listinfo="" bioconductor=""> >> Search the archives: http://news.gmane.org/gmane.** >> science.biology.informatics.**conductor<http: news.gmane.org="" gmane="" .science.biology.informatics.conductor=""> >> > > -- > James W. MacDonald, M.S. > Biostatistician > University of Washington > Environmental and Occupational Health Sciences > 4225 Roosevelt Way NE, # 100 > Seattle WA 98105-6099 > > ______________________________**_________________ > Bioconductor mailing list > Bioconductor@r-project.org > https://stat.ethz.ch/mailman/**listinfo/bioconductor<https: stat.et="" hz.ch="" mailman="" listinfo="" bioconductor=""> > Search the archives: http://news.gmane.org/gmane.** > science.biology.informatics.**conductor<http: news.gmane.org="" gmane.="" science.biology.informatics.conductor=""> > -- Nitish Kumar Mishra Office: 580-224-6163 Mob : 240-898-7311 [[alternative HTML version deleted]]
ADD REPLY
0
Entering edit mode
Please have a look at some prior art in the gplots library. It is used the same way, so you can save that code, and plots elliptic Venn diagrams for up to 5 sets - no variation in the sizes of the ellipses, though. Steffen -------- Original-Nachricht -------- > Datum: Fri, 13 Apr 2012 12:24:54 -0500 > Von: Nitish Kumar Mishra <nitishimtech at="" gmail.com=""> > An: "James W. MacDonald" <jmacdon at="" uw.edu=""> > CC: bioconductor at r-project.org > Betreff: Re: [BioC] Creating a Venn Diagram with 4 sets > Hi, > vennDiagram can use up to 3 sets, it can't use for 4 sets. You can use > online tool Venny (use up to 4 set, also produce good quality image) : > http://bioinfogp.cnb.csic.es/tools/venny/index.html for Venn diagram plot. > Hope that Venny can help you. > > Thanks > Nitish > On Fri, Apr 13, 2012 at 8:25 AM, James W. MacDonald <jmacdon at="" uw.edu=""> > wrote: > > > Hi Whomever, > > > > Three things. > > > > First, VennDiagram isn't a BioC package, so this isn't the correct list > > for this question. You would be better off on R-help, or directly > > contacting the author of that package. > > > > Second, anonymous posts tend to bring out the less civilized nature of > > man. If you choose not to identify yourself, it is less likely you will > get > > a response, and if you do get a response it will likely be more terse > and > > possibly rude than if you had identified yourself. > > > > > > Third, the data you show in your matrix are not the same as what you get > > from the list (x) you use in your call to venn.diagram(). How did you > > decide to construct the list (x), and why did you think it would give > you > > the same results as in your data structure? When you re-post on R-help, > you > > should at least show how you arrived at your data matrix, and explain > why > > you think the list you pass to venn.diagram() should give identical > results. > > > > Best, > > > > Jim > > > > > > > > On 4/13/2012 4:02 AM, lcarvalh at btk.fi wrote: > > > >> I am trying to create a Venn diagram for this data, and the Venn > diagram > >> needs > >> to show the number of occurring cases of each different intersection, > for > >> example in the diagram section were c1,c2 intersect each other should > be > >> the > >> value 13. > >> > >> Data: > >> > >> c1 c2 c3 c4 Counts > >> [1,] 0 0 0 0 26 > >> [2,] 0 0 0 1 27 > >> [3,] 0 0 1 0 4 > >> [4,] 0 0 1 1 6 > >> [5,] 0 1 0 0 5 > >> [6,] 0 1 0 1 12 > >> [7,] 0 1 1 0 42 > >> [8,] 0 1 1 1 78 > >> [9,] 1 0 0 0 18 > >> [10,] 1 0 0 1 52 > >> [11,] 1 0 1 0 4 > >> [12,] 1 0 1 1 63 > >> [13,] 1 1 0 0 13 > >> [14,] 1 1 0 1 47 > >> [15,] 1 1 1 0 88 > >> [16,] 1 1 1 1 182 > >> > >> I have been trying to use the package VennDiagram, with the function > >> venn.diagram. But I am only able to get some of the values correct in > the > >> diagram. Can anyone give me some help? maybe some other way of making a > >> nice > >> looking venn diagram? or help me correcting this code so that I can > >> produce the > >> correct venn diagram? > >> > >> Code: > >> > >> > >> library (VennDiagram) > >> library(grid) > >> > >> venn.diagram( > >> x = list( > >> comp1=c(1:18, 19:31, 32:119, 120:123, 124:186, 187:238, > >> 239:420, > >> 421:467), > >> > >> comp4=c(692:695,561:603,472:**560,120:123, 187:238, > >> 239:420, 603:681,682:688), > >> comp2=c(468:472,19:31, 32:119, 239:420, 421:467, > 561:602, > >> 603:680, 681:6918), > >> comp3=c(780:807,716:779,603:**680,681:691, 239:420, > >> 421:467, 124:186, > >> 187:238) ), > >> filename = "quadruple_Venn.tiff", > >> col = "black", > >> lty = "dotted", > >> lwd = 4, > >> fill = c("cornflowerblue", "green", "yellow", "darkorchid1"), > >> alpha = 0.50, > >> label.col = c("orange", "white", "darkorchid4", "white", > "white", > >> "white", > >> "white", "white", "darkblue", "white", "white", "white", "white", > >> "darkgreen", > >> "white"), > >> cex = 2.5, > >> fontfamily = "serif", > >> fontface = "bold", > >> cat.col = c("darkblue", "darkgreen", "orange", "darkorchid4"), > >> cat.cex = 2.5, > >> cat.fontfamily = "serif" > >> ); > >> > >> ______________________________**_________________ > >> Bioconductor mailing list > >> Bioconductor at r-project.org > >> > https://stat.ethz.ch/mailman/**listinfo/bioconductor<https: stat.et="" hz.ch="" mailman="" listinfo="" bioconductor=""> > >> Search the archives: http://news.gmane.org/gmane.** > >> > science.biology.informatics.**conductor<http: news.gmane.org="" gmane.="" science.biology.informatics.conductor=""> > >> > > > > -- > > James W. MacDonald, M.S. > > Biostatistician > > University of Washington > > Environmental and Occupational Health Sciences > > 4225 Roosevelt Way NE, # 100 > > Seattle WA 98105-6099 > > > > ______________________________**_________________ > > Bioconductor mailing list > > Bioconductor at r-project.org > > > https://stat.ethz.ch/mailman/**listinfo/bioconductor<https: stat.et="" hz.ch="" mailman="" listinfo="" bioconductor=""> > > Search the archives: http://news.gmane.org/gmane.** > > > science.biology.informatics.**conductor<http: news.gmane.org="" gmane.="" science.biology.informatics.conductor=""> > > > > > > -- > Nitish Kumar Mishra > Office: 580-224-6163 > > Mob : 240-898-7311 > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: > http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD REPLY
0
Entering edit mode
@enrique-meza-c-5226
Last seen 10.2 years ago
Maybe this example can help you. library(limma) hsb2<-read.table("http://www.ats.ucla.edu/stat/R/notes/hsb2.csv", sep=',', header=T) attach(hsb2) hw<-(write>=60) hm<-(math >=60) hr<-(read >=60) c3<-cbind(hw, hm, hr) a <- vennCounts(c3) vennDiagram(a) Best, Enrique Meza //
ADD COMMENT

Login before adding your answer.

Traffic: 573 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6