js229 / Vennerable

Vennerable provides Venn diagrams in R. It displays Venn and Euler diagrams for up to 9 different sets and using a variety of geometries. It allows the display of area-weighted Venn diagrams and allows fine graphical control over the result.
90 stars 39 forks source link

Chow-Ruskey bug with proposed patch #12

Open js229 opened 8 years ago

js229 commented 8 years ago

Ported from R-Forge:

Hi,

I've been running into a bug when plotting the ChowRuskey diagrams with certain Venn objects (Vennerable versions 3.0 and 2.2, R3.0.1, MacOSX 10.7.5):

v A Venn object on 4 sets named a,b,c,d 0000 1000 0100 1100 0010 1010 0110 1110 0001 1001 0101 1101 0011 1011 0111 1111 0 7845 453 5902 12 17 81 1798 272 1059 40 360 1 1 6 140

plot(v) Error in if (nointersect) { : missing value where TRUE/FALSE needed In addition: Warning messages: 1: In min(which(!fequal(fromdist, 0))) : no non-missing arguments to min; returning Inf 2: NAs introduced by coercion

Having looked through the code, the problem seems to occur in the .find.triangle.within.face function, in which nextix gets set to Inf in cases where all(fequal(fromdist, 0)). While I can't really pretend to be sure that it's correct, the attached patch seems to provide at least a partial fix, in case it's of any interest. It simply falls back to the exact inequality (fromdist!=0) to pick an appropriate value in such situations.

Many thanks for a great package,

Tim Rayner

js229 commented 8 years ago

patch.txt