Does anyone know how to get the R package VennDiagram to scale the circles of a Venn diagram containing 3 intersecting sets according to set size?
I can achieve such scaling with the venneular package, but I find this a bit limited in terms of other graphical options compared to VennDiagram.
The VennDiagram package documentation suggests setting the argument 'scaled' to TRUE ought to do the trick, but I find this produces 3 circles of equal size.
The package documentation does cryptically suggest that the scaled argument may only work for certain diagrams:
?draw.triple.venn
reveals:
scaled: "Boolean indicating whether to scale circle sizes in certain Euler diagrams according to set sizes or not"
and
?venn.diagram
#Argument Venn Sizes Class Description
#scaled 2, 3 logical Enable scaling for two-set and certain three-set Euler diagrams.
A toy example of my code:
require(VennDiagram)
venn.plot <- draw.triple.venn(
area1 = 70,
area2 = 250,
area3 = 500,
n12 = 30,
n23 = 60,
n13 = 10,
n123 = 5,
category = c("C1", "C2", "C3"),
fill = c("blue", "red", "green"),
scaled=TRUE)
tiff(filename = "test.tiff", compression = "none",type = "quartz",antialias = "none")
grid.draw(venn.plot)
dev.off()
Similarly this code using the 'venn.diagram' function doesn't produce the required scaling:
venn.diagram(x=list(A=c(1:15,16:20), B=c(6:15,21:30,100:150), C=c(11:30,200:300)),
filename="test.tiff",
fill = c("blue", "yellow", "red"), scaled=TRUE)
Thanks v.much
Jim
So to answer my own question: for certain configurations it is mathematically impossible to create a scaled 3-way Venn using circles.
General scaling for three-set Venn diagrams are disabled due to potentially misleading visual representation of the data
Please try to use the following two tools,
http://bioinformatics.psb.ugent.be/webtools/Venn/ http://bioinfogp.cnb.csic.es/tools/venny/index.html
And to your question, please read the following notes:
the key point is to set overrideTriple in draw.triple.venn
Euler diagrams are drawn for 19 special cases if euler.d == TRUE. Certain Euler diagrams make use of the scaled, sep.dist, or offset arguments specific to two-set Venn diagrams where appropriate. The function defaults to placing the three circles in a triangular arrangement with two sets on top and one set below. The circles correspond to area1, area2 and area3 in a clockwise fashion with area1 on the top left. N.B. General scaling for three-set Venn diagrams are disabled due to potentially misleading visual representation of the data. To re-enable, assign any value to variable overrideTriple
http://cran.r-project.org/web/packages/VennDiagram/VennDiagram.pdf
I use Vennerable instead. Reading data into the Venn-object is somewhat complicated but it generates weighted/scaled three-set diagrams + graphic options.
If you would consider a different approach, we have developed the nVennR package with other shapes to convey region sizes.
mySVG <- plotVenn(list(A=c(1:15,16:20)), list(B=c(6:15,21:30,100:150)), list(C=c(11:30,200:300)))
Quasi-proportional Venn diagram
This R package is preliminary, and the options for output control are very limited. We are working on a new version with the feedback we are getting. There is also a Web version with more options, and the output can always be edited with external tools like Inkscape.
My solution:
overrideTriple=T
draw.triple.venn(9, 20, 30, 2, 10, 3, 2, category =
rep("", 3), rotation = 1, reverse = FALSE, euler.d = F, scaled = F)
来源:https://stackoverflow.com/questions/11727068/scaling-triple-venn-diagram-in-r-with-venndiagram-package