我正在尝试在 R 中制作一个 4 向维恩图。
我有我想放在图表中的数据:
谁能给我一个建议怎么做?我尝试使用函数 vennDiagram() 但这不起作用,因为它是一个 4way 图。
我也在尝试使用 VennDiagram 包,但确实混淆了将数据“分配”到图中正确位置的方式。我正在使用此代码:
library (VennDiagram)
venn.diagram(
x=list(
I=c(1:18,19:31,32:119,125:129,130:192,193:144,145:326,327:373),
VI=c(516:542,510:515,420:497,498:509,145:326,327:373,130:192,193:144),
II=c(19:31,32:119,145:326,327:373,374:378,378:419,420:497,498:509),
III=c(506:509,378:419,32:119,125:129,130:192,145:326,420:497,510:515)
),
filename = "4Way_Venn.tiff",
col = "black",
lty = "dotted",
lwd = 4,
fill = c("cornflowerblue", "green", "yellow", "darkorchid1"),
alpha = 0.50,
label.col = c("orange", "white", "darkorchid4", "white", "white", "white",
"white", "white", "darkblue", "white", "white", "white",
"white", "darkgreen", "white"),
cex = 2.5,
fontfamily = "serif",
fontface = "bold",
cat.col = c("darkblue", "darkgreen", "orange", "darkorchid4"),
cat.cex = 2.5,
cat.fontfamily = "serif"
);
谁能帮我?也许使用更简单的解决方案然后使用 VennDiagram 包。
最佳答案
我可能在这里忽略了这一点,但我不确定你想如何使用这些“计数”来制作你的维恩图?从“c1”到“c4”列,您可以使用 venneuler 包轻松制作维恩图:
require(venneuler)
#here I replicate your data
#because it's repeatable, you can use `rep` function to generate it
c1 <- rep(c(0,1),each=8)
c2 <- rep(c(0,1),each=4,times=2)
c3 <- rep(c(0,1),each=2,times=4)
c4 <- rep(c(0,1),times=8)
#put your data into matrix
m <- as.matrix(data.frame(C1=c1,C2=c2,C3=c3,C4=c4))
#plot it
v = venneuler(m)
plot(v)
关于r - R中的4路维恩图?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/10111430/