我正在尝试使用VennDiagram包中的calculate.overlap函数来首先计算并打印维恩图。我能够计算我的数据集的重叠,但寻找帮助如何打印维恩图形。有人可以提供帮助吗?我仔细阅读了文档,但没有找到。
> library('VennDiagram')
# A simple single-set diagram
cardiome <- letters[1:10]
superset <- letters[8:24]
overlap <- calculate.overlap(
x = list(
"Cardiome" = cardiome,
"SuperSet" = superset
)
);
答案 0 :(得分:2)
功能venn.diagram()
可以做到。例如在你的例子中
venn.diagram(x = list(
"Cardiome" = cardiome,
"SuperSet" = superset
), "plot_venn")
它保存到工作目录。输入getwd()
以查看其设置的内容。
参见
?venn.diagram()
了解更多信息。
答案 1 :(得分:2)
另一个简单示例,演示如何使用VennDiagram
包打印维恩图:
library(VennDiagram)
cardiome <- letters[1:10]
superset <- letters[8:24]
overlap <- calculate.overlap(
x <- list("Cardiome"=cardiome, "SuperSet"=superset))
venn.plot <- draw.pairwise.venn(
area1 = length(cardiome),
area2 = length(superset),
cross.area = length(overlap),
category = c("Cardiome", "Superset"),
fill = c("blue", "red"),
lty = "blank",
cex = 2,
cat.cex = 2,
cat.pos = c(180, 180),
cat.dist = 0.05,
cat.just = list(c(0, 1), c(1, 1))
)
grid.draw(venn.plot)
savePlot(filename="venndiag", type="png")
在集合中带有项目标签的维恩图:
library(RAM)
vectors <- list(Cardiome=cardiome, Superset=superset)
group.venn(vectors=vectors, label=TRUE,
fill = c("blue", "red"),
cat.pos = c(180, 180),
lab.cex=1.1)
答案 2 :(得分:1)
?venn.diagram
建议这个
library('VennDiagram')
venn.plot <- venn.diagram(
x = list(
cardiome = letters[1:10],
superset = letters[8:24]
),
filename = NULL
);
grid.draw(venn.plot);