简体   繁体   English

使用venn.diagram包的面积比例维恩图

[英]Area-proportional Venn diagrams using venn.diagram package

I read in another thread closed to comment that it is possible to create an area proportional venn diagram using the package venn.diagram in R. 我读完另一个封闭的线程以评论说,可以使用R中的venn.diagram包创建面积比例维恩图。

I adapted the code to my data (gene lists), but the area of the circles does not correlate with the length of the data vectors. 我将代码修改为适合我的数据(基因列表),但是圆圈的面积与数据向量的长度无关。

Any suggestions to solve this problem? 有解决这个问题的建议吗?

Thanks! 谢谢! code and output below. 代码和下面的输出。

CODE SAMPLE 代码样本

venn.diagram(x = list(G015_All, G08_Female, G015_Male),
                 na = "remove",
                 category.names = c("G015_All", "G08_Female", "G015_Male"),
                 fill = c('lightyellow', 'paleturquoise', 'lightgreen'),
                 alpha = c(0.5, 0.5, 0.5),
                 cex = 2,
                 cat.fontface = 4,
                 lty =2,
                 fontfamily =3,
                 filename = "VennPlot.png",
                 imagetype = "png",
                 output = T)

OUTPUT OUTPUT VennPlot

There are several R packages to do that, each with different approaches. 有几个R软件包可以做到这一点,每个软件包都有不同的方法。 My own attempt, nVennR draws proportional circles that are enclosed by the lines in the diagram. 我自己的尝试, nVennR绘制了比例圆,这些圆被图中的线包围。 You can read the vignette for examples on how to use it. 您可以阅读插图,以获取有关如何使用它的示例。 There is also a web server for up to six sets. 还有一个最多可容纳六套的网络服务器 I have attempted to reproduce the diagram you show as an example. 我试图重现您作为示例显示的图表。 I had to enter the set sizes by hand, but the diagram can also be produced from the lists as in your example (as shown in the vignette): 我必须手动输入设置的尺寸,但是该图也可以像您的示例一样从列表中生成(如插图所示):

> library(nVennR)
> myV <- createVennObj(nSets = 3, sNames = c("G015_All", "G08_Female", "G015_Male"), sSizes = c(0, 7, 5212, 35, 1, 0, 2, 37))
> myV <- plotVenn(nVennObj = myV, setColors=c('yellow', 'turquoise', 'green')) 

And the result: 结果:

成比例的

Just a couple of things. 只是几件事。 First, I changed the colors. 首先,我改变了颜色。 nVennR uses opacity to mix colors, and therefore you get fainter colors by default. nVennR使用不透明度来混合颜色,因此默认情况下会获得较暗的颜色。 Second, the shape of the small sets is not perfect. 其次,小套的形状并不完美。 This has to do with the algorithm to pack the circles, and should only happen in rare cases, like extreme imbalances in group sizes. 这与填充圆圈的算法有关,并且仅在极少数情况下才会发生,例如组大小的极端不平衡。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM