jolars / eulerr

Area-Proportional Euler and Venn Diagrams with Ellipses
https://jolars.github.io/eulerr/
GNU General Public License v3.0
129 stars 18 forks source link

Missing overlaps in euler plot #92

Closed bakerwm closed 2 years ago

bakerwm commented 2 years ago

Is there a way to fix the following problem?

In the following example, missing area A&B (12) in euler( ), but works in venn( ).

# R code
x <- setNames(c(164, 561, 166, 12, 459, 703, 162), nm = c("A", "B", "C", "A&B", "A&C", "B&C", "A&B&C"))
plot(euler(x), quantities = T) # A&B removed
plot(venn(x), quantities = T) # A&B present

find out that, A&B area fitted value is 0, could be the reason.

> euler(x)
      original  fitted residuals regionError
A          164 175.901   -11.901       0.004
B          561 564.940    -3.940       0.002
C          166 200.902   -34.902       0.015
A&B         12   0.000    12.000       0.005
A&C        459 442.111    16.889       0.010
B&C        703 692.863    10.137       0.009
A&B&C      162 179.576   -17.576       0.007

diagError: 0.015 
stress:    0.002 
zhxiaokang commented 2 years ago

Same problem here, and even worse, none of the overlaps were shown:

> euler(c(a=256, b=270, c=104, d=200, "a&b"=58, "a&c"=2, "a&d"=8, "b&c"=4, "b&d"=6, "c&d"=6))
        original fitted residuals regionError
a            256    256         0       0.028
b            270    270         0       0.030
c            104    104         0       0.012
d            200    200         0       0.022
a&b           58      0        58       0.063
a&c            2      0         2       0.002
a&d            8      0         8       0.009
b&c            4      0         4       0.004
b&d            6      0         6       0.007
c&d            6      0         6       0.007
a&b&c          0      0         0       0.000
a&b&d          0      0         0       0.000
a&c&d          0      0         0       0.000
b&c&d          0      0         0       0.000
a&b&c&d        0      0         0       0.000

diagError: 0.063 
stress:    0.018 

And when plotting it, I only got 4 un-adjacent circles.

jolars commented 2 years ago

There are no guarantees that the resulting fit is perfect. Please see #80, #54, etc