jolars / eulerr

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

Plotting incorrectly #54

Closed yesitsjess closed 5 years ago

yesitsjess commented 5 years ago

cts <- c(27, 7, 17, 12, 12, 11, 5, 0, 12, 0, 1, 1, 0, 4, 0, 1, 0, 4, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1)

nms <- c("A", "B", "C", "D", "E", "F", "A&B", "A&C", "A&D", "A&E", "A&F", "B&C", "B&D", "B&E", "B&F", "C&D", "C&E", "C&F", "D&E", "D&F", "E&F", "A&B&C", "A&B&D", "A&B&E", "A&B&F", "A&C&D", "A&C&E", "A&C&F", "A&D&E", "A&D&F", "A&E&F", "B&C&D", "B&C&E", "B&C&F", "B&D&E", "B&D&F", "B&E&F", "C&D&E", "C&D&F", "C&E&F", "D&E&F", "A&B&C&D", "A&B&C&E", "A&B&C&F", "A&B&D&E", "A&B&D&F", "A&B&E&F", "A&C&D&E", "A&C&D&F", "A&C&E&F", "A&D&E&F", "B&C&D&E", "B&C&D&F", "B&C&E&F", "B&D&E&F", "C&D&E&F", "A&B&C&D&E", "A&B&C&D&F", "A&B&C&E&F", "A&B&D&E&F", "A&C&D&E&F", "B&C&D&E&F", "A&B&C&D&E&F")

venn <- structure(combs_cnt, names=combs_txt) plot(euler(venn, shape="ellipse"), quantities=T)

For example, there should be a total of 49 in the circle for A, but this plot shows only 46. A alone, A&B, A&D, A&F and A&D&F are correct, but A&C&D, A&B&D&E and A&B&C&D&E&F are missing.

Any advice?

jolars commented 5 years ago

There is no guarantee that the resulting diagram is going to be exact (i.e. perfectly represent the input). Please make it a habit to always check the fit before plotting.

e <- euler(venn, shape="ellipse")
e
            original fitted residuals regionError
A                 27     27         0       0.014
B                  7      7         0       0.004
C                 17     17         0       0.009
D                 12     12         0       0.006
E                 12     12         0       0.006
F                 11     11         0       0.006
A&B                5      5         0       0.003
A&C                0      0         0       0.000
A&D               12     12         0       0.006
A&E                0      0         0       0.000
A&F                1      1         0       0.001
B&C                1      0         1       0.008
B&D                0      0         0       0.000
B&E                4      4         0       0.002
B&F                0      0         0       0.000
C&D                1      0         1       0.008
C&E                0      0         0       0.000
C&F                4      4         0       0.002
D&E                1      0         1       0.008
D&F                1      1         0       0.001
E&F                0      0         0       0.000
A&B&C              0      0         0       0.000
A&B&D              0      0         0       0.000
A&B&E              0      0         0       0.000
A&B&F              0      0         0       0.000
A&C&D              1      0         1       0.008
A&C&E              0      0         0       0.000
A&C&F              0      0         0       0.000
A&D&E              0      0         0       0.000
A&D&F              1      1         0       0.001
A&E&F              0      0         0       0.000
B&C&D              0      0         0       0.000
B&C&E              0      0         0       0.000
B&C&F              0      0         0       0.000
B&D&E              0      0         0       0.000
B&D&F              0      0         0       0.000
B&E&F              0      0         0       0.000
C&D&E              0      0         0       0.000
C&D&F              0      0         0       0.000
C&E&F              1      0         1       0.008
D&E&F              0      0         0       0.000
A&B&C&D            0      0         0       0.000
A&B&C&E            0      0         0       0.000
A&B&C&F            0      0         0       0.000
A&B&D&E            1      0         1       0.008
A&B&D&F            0      0         0       0.000
A&B&E&F            0      0         0       0.000
A&C&D&E            0      0         0       0.000
A&C&D&F            0      0         0       0.000
A&C&E&F            0      0         0       0.000
A&D&E&F            0      0         0       0.000
B&C&D&E            0      0         0       0.000
B&C&D&F            0      0         0       0.000
B&C&E&F            0      0         0       0.000
B&D&E&F            0      0         0       0.000
C&D&E&F            0      0         0       0.000
A&B&C&D&E          0      0         0       0.000
A&B&C&D&F          0      0         0       0.000
A&B&C&E&F          0      0         0       0.000
A&B&D&E&F          0      0         0       0.000
A&C&D&E&F          0      0         0       0.000
B&C&D&E&F          0      0         0       0.000
A&B&C&D&E&F        1      0         1       0.008

Observe that some intersections are missing, hence the missing quantities in the plot.

yesitsjess commented 5 years ago

Thanks for the response. In case anyone lands here from Googling a similar issue, I found UpSetR a useful solution for this problem