user2171526
user2171526

Reputation: 55

r venn diagram partial areas negative

I got an Error when I was drawing my venn diagram by using R. Here is the code:

library(VennDiagram)
venn.plot <- draw.triple.venn(
area1 = 2249,
area2 = 2124,
area3 = 2133,
n12 = 2061,
n23 = 2101,
n13 = 2072,
n123 = 2030,
category = c("Human(all)", "Mouse(all)", "Rat(all)"),
col = "black",
alpha=0.5,
fill = c("darkorchid1", "cornflowerblue", "green"),
lty = "blank",
cex = 1,
cat.cex = 2,
cat.col = c("darkorchid4", "darkblue", "darkgreen")
);
tiff(filename = "2.f.tiff", compression = "lzw");
grid.draw(venn.plot);
dev.off();

It gives me an ERROR: "draw.triple.venn(area1 = 2249, area2 = 2124, area3 = 2133, n12 = 2061,Impossible: partial areas negative"

Why my codes end up with this Error?

Upvotes: 0

Views: 1138

Answers (1)

dayne
dayne

Reputation: 7784

You need to check your numbers/math. If you define the intersections as you have circle 3 needs to have at least 2143 counts, and you have only given it an area of 2133.

I checked the documentation for the VennDiagram package, and as I understand it the area1, area2, and area3 should be the total area of those sets - not just the subset that does not overlap with the other sets.

When I do out the math I get -10 and -8 for the only 3 and only 2 categories, respectively.

Upvotes: 1

Related Questions