Area proportional 3-way Venn Diagram in R

血红的双手。 提交于 2019-12-11 04:34:29

问题


I read quite a few threads on creating Venn Diagram in R. Is it possible to create a proportional triple Venn Diagram talks about using eulerr package. Venn diagram proportional and color shading with semi-transparency is very comprehensive and did help me with a lot of the other graphs I needed.

While above threads are fantastic, I believe that there is one problem that is still not solved by above threads. It happens when the intersection of three sets represents a huge portion of overall area. In my case, R&S&W is 92% of total area. Hence, the graph is imperceptible and ugly. Is there any way we can fix this?

Here's my data and code:

dput(Venn_data)
structure(c(94905288780.4383, 3910207511.54001, 2615620176.44757, 
1125606833.85568, 187542691.618916, 104457994.331746, 96049675.0823557
), .Names = c("R&S&W", "R&S", "S&W", "S", "R", "W", "R&W"))

VennDiag2 <- eulerr::euler(Venn_data,shape="ellipse")
windows()
plot(VennDiag2)

Here's the output:

I cannot see what's R&S, S&W, R, S, W etc.

I also tried venneuler package.

Here's my code:

windows()
 v<-venneuler(Venn_data)
 plot(v)

Unfortunately, this didn't help either. Here's the output.

Is there any way we can fix this? I am not an expert so I thought of asking here. I'd sincerely appreciate any help. I have spent quite a few hours on this and am still not able to get this to work.


回答1:


You could always retrieve the plot parameters yourself and position the labels using arrows or something, but another option would be to use a legend instead of labels.

plot(VennDiag2, legend = TRUE)

Is is somewhat questionable whether there is much use for an Euler diagram at all here though.




回答2:


There is a different visualization strategy in the nVennR package I posted some months ago:

library(nVennR)
v <- createVennObj(nSets = 3, sNames = c('R', 'S', 'W'), sSizes = c(0, 104457994.331746, 1125606833.85568, 2615620176.44757, 187542691.618916, 96049675.0823557, 3910207511.54001, 94905288780.4383))
v <- plotVenn(nVennObj = v)

I had not anticipated the need for such large numbers, and I see they get cropped. However, the result is a vector image (svg), and the picture can be edited afterwards. You can find more details, including why the numbers are in that order, in the vignette. The package can also handle larger numbers of sets.



来源:https://stackoverflow.com/questions/49012418/area-proportional-3-way-venn-diagram-in-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!