3设置venn图与venneuler

时间:2017-02-10 11:00:36

标签: r venn-diagram

这是我的代码,用R包venneuler创建一个3组维恩图,在每个圆和交叉点插入两行数据(代表上调和下调基因)。我与你分享,因为我花了一段时间才找到这个解决方案。

library(venneuler)
MyVenn <- venneuler(c(A=2,B=2,C=2,"A&B"=0.8,"A&C"=0.7,"B&C"=0.8,"A&B&C"=0))
MyVenn$labels <- c("","","")
MyVenn$diameters<-c(0.4,0.4,0.4)
plot(MyVenn, col="grey80", border = "black")
          text(0.35,0.6,"181\n161", cex = 1.5) #A
          text(0.65,0.6,"27\n14", cex = 1.5) #B
          text(0.4997455,0.325,"0\n0", cex = 1.5) #C
          text(0.5,0.6,"0\n0", cex = 1.5) #AB,
          text(0.59,0.45,"0\n0", cex = 1.5)  #BC
          text(0.4,0.45,"0\n0", cex = 1.5)  #AC
          text(0.5,0.5,"0\n0", cex = 1.5) #ABC

这就是它的样子(保存为500x500): enter image description here

我不知道如何在圈外添加标签,欢迎提出建议,更正,改进

1 个答案:

答案 0 :(得分:1)

只需像以前一样手动添加text()

text(MyVenn$centers[1, 1] + 0.2, MyVenn$centers[1, 2] + 0.2, "B", cex = 2)
text(MyVenn$centers[2, 1] + 0.2, MyVenn$centers[2, 2] - 0.2, "C", cex = 2)
text(MyVenn$centers[3, 1] - 0.2, MyVenn$centers[3, 2] + 0.2, "A", cex = 2)

Imgur