Sam
Sam

Reputation: 8192

VennDiagram for data gives error?

I have the following data:

Set1    : 82
Set2    : 44
Set3    : 56
Set4    : 53
1,2     : 27
1,3     : 37
1,4     : 30
2,3     : 22
2,4     : 14
3,4     : 19
1,2,3   : 18
1,2,4   : 13
1,3,4   : 20
2,3,4   : 11
1,2,3,4 : 11

1,2 means Set1 . intersection . Set2, and so on ...

When I try to make a VennDiagram for this data-set using draw.quad.venn, i get the following error,

Error in draw.quad.venn(82, 44, 56, 53, 27, 37, 30, 22, 14, 19, 18, 13,  : 
Impossible: partial areas negative

I dont understand what i am doing wrong?

UPDATE:

The following is the command line that i used:

v.all <- draw.quad.venn( 82, 44, 56, 53, 27, 37, 30, 22, 14, 19, 18, 13, 20, 11, 10, category = c( "Set1", "Set2", "Set3", "Set4" ), fill=c( "red", "blue", "orange", "green" ), cex = 0.75, cat.cex=0.85 )

Interestingly, when i use

v <- venneuler( c( A=82, B=44, C=56, D=53, "A&B"=27, "A&C"=37, "A&D"=30, "B&C"=22, "B&D"=14, "C&D"=19, "A&B&C"=18, "A&B&D"=13, "A&C&D"=20, "B&C&D"=11, "A&B&C&D"=11 ))
plot(v)

It works!!

enter image description here

So now i am really confused.

Upvotes: 0

Views: 1801

Answers (2)

user1317221_G
user1317221_G

Reputation: 15441

Without your code it is hard to help. Possibly it is impossible to draw your data due to the way it is supposed to overlap. Maybe you have errors in the data?

However if it is a code issue, using some of your data and a different package I can offer an alternative route:

require(venneuler)
m <- as.matrix(c(
0, 27, 37, 30,
27, 0, 22, 14,
37 ,22, 0, 19,
30,14,19,0)byrow=T,nrow=3)
v = venneuler(m)
plot(v)

which gives gives:

Upvotes: 1

Count Zero
Count Zero

Reputation: 640

The constraints in the code are straight forward. Here it is exactly;

     if (any(a1 < 0, a2 < 0, a3 < 0, a4 < 0, a5 < 0, a6 < 0, a7 < 
            0, a8 < 0, a9 < 0, a10 < 0, a11 < 0, a12 < 0, a13 < 0, 
            a14 < 0, a15 < 0)) {
            stop("Impossible: partial areas negative")
        }

Upvotes: 1

Related Questions