使用R重绘维恩图的最简单方法是什么?我没有用于生成维恩图的数据,但其余的图是用R绘制的...我想保持相同的结构,这意味着我必须以某种方式在R中重绘它。
这是我用于其他维恩图的代码。
v1 <- venn.diagram(list(1=a, 2=b, 3=c, 4=d), filename=NULL, fill=rainbow(4), cex.prop=NULL, cex=1.5)
png("TEST.png", width=7, height=7, units='in', res=150)
grid.newpage()
grid.draw(v1)
dev.off()
答案 0 :(得分:10)
您可以调用draw.venn。*函数并直接输入重叠区域。这将是乏味的,但我认为这是你唯一的选择。你会注意到群组的顺序是不同的,也许有一种方法来控制它,但我不确定那是什么。
a <- c(2411, 12433,939,238, 1575,2483,2923,540)
b <- c(1575, 2483,2923, 540, 1255, 1330, 615, 622)
c <- c(1247, 1330, 2483, 12433, 150, 615, 2923, 939)
d <- c(150,615,2923,939, 1245, 622, 540, 238)
draw.quad.venn(area1 = sum(a), area2 = sum(b), area3 = sum(c), area4 = sum(d),
n12 = sum(a[5:8]), n13 = sum(a[c(2,3,6,7)]), n14 = sum(a[c(3,4,7,8)]),
n23 = sum(b[c(2,3,6,7)]), n24 = sum(b[c(3,4,7,8)]),
n34 = sum(c[5:8]),
n123 = sum(a[6:7]),
n134 = sum(a[c(3,7)]),
n124 = sum(a[7:8]),
n234 = sum(b[c(3,7)]),
n1234 = 2923, category = c("A","B","C","D"),
fill = colorspace::rainbow_hcl(4),
col = colorspace::rainbow_hcl(4)[c(1,3,4,2)], lwd = rep(1, 4))
答案 1 :(得分:0)