scaling triple Venn diagram in R with VennDiagram package

user1563570 picture user1563570 · Jul 30, 2012 · Viewed 22.1k times · Source

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

Answer

user1563570 picture user1563570 · Aug 13, 2012

So to answer my own question: for certain configurations it is mathematically impossible to create a scaled 3-way Venn using circles.