I'm trying to understand how venneuler
works and it outputs a venn diagram I wouldn't expect. I like to work with simple examples when I'm trying to understand something. I'm supplying the matrix below which I believe is :
a logical or numeric matrix whose columns represent sets and co-occurrence is defined by non-zero (rep. TRUE) values in rows (weight for a row being 1 for logical matrices or the row sum for numeric matrices). -venneular manual-
I would expect if two things both have 1's or 0's in the same row they'd have overlap in their venn. So in this matrix w and z have no 1's or 0's in common. I'd expect their venn's not to overlap but they do (see figure 1 below). Why? If I'm supplying wrong information or it needs to be reformatted please explain. If it's in the calculations of venneular
please explain that.
w x y z
[1,] 1 0 1 0
[2,] 0 0 1 1
[3,] 0 0 1 1
[4,] 1 1 0 0
The code for the above:
library(venneuler)
w <- c(1,0,0,1)
x <- c(0, 0, 0, 1)
y <- c(1, 1, 1,0)
z <- c(0, 1, 1,0)
a <- cbind(w, x, y, z)
v <- venneuler(a)
plot(v)
Try these - same as the example of ?venneuler
:
library(venneuler)
plot(venneuler(c(A=1, B=1, C=1, "A&B"=0.5, "A&C"=0.5, "B&C"=0.5 ,"A&B&C"=0.5)))
plot(venneuler(c(A=1, B=1, C=1, "A&B"=0.5, "A&C"=0.5, "B&C"=0.5 ,"A&B&C"=0)))
Any significant difference? No. Why? because the second case is impossible! Imagine how any 2 of 3 circles of area = 1 have intersection of area = 0.5, but there is nothing in the intersection of all 3?
Now if you like to have a good representation of your desired matrix, I suggest using VennDiagram
package:
library(VennDiagram)
w <- c(1, 0, 0, 1)
x <- c(0, 0, 0, 1)
y <- c(1, 1, 1, 0)
z <- c(0, 1, 1, 0)
venn.diagram(
x = list(w = which(w==1),x = which(x==1),y = which(y==1),z = which(z==1)),
height=2000, width=2000, resolution=300, col = "transparent",margin = 0.2,
fill = c("cornflowerblue", "green", "yellow", "darkorchid1"), alpha = 0.50,
cex = 1.5,filename="~/Desktop/a.tiff",fontfamily = "serif",fontface = "bold",
cat.col = c("darkblue", "darkgreen", "orange", "darkorchid4"),cat.cex = 1.5,
cat.pos = 0,cat.dist = 0.07,cat.fontfamily = "serif",rotation.degree = 270,
label.col = "white");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With