【发布时间】:2016-05-29 05:03:44
【问题描述】:
我正在尝试以优化的方式(见下文)绘制维恩图,并将案例作为内部标签(而不是每个交叉点的案例数)。我知道他们每个人都有帖子,但没有一个解决方案允许我两者都做。
我有这个:
x <- list()
x$A <- as.character(c("Per_36","Cent","CeM","vDG","LAVL","RSGd"))
x$B <- as.character(c("vCA1","DLE","Per_36","vDG","DIE","Per_35"))
x$C <- as.character(c("vCA1","Cg1","LAVL", "RSGc", "RSGd","Per_35","Per_36"))
x$D <- as.character(c("Por","Cg1","RSGc","LAVL","Per_35","RSGd","Per_36"))
require(VennDiagram)
v0 <-venn.diagram(x, lwd = 3, col = c("red", "green", "orange", "blue"),
fill = c("red", "blue", "green", "orange"), apha = 0.5, filename = NULL)
grid.draw(v0)
overlaps <- calculate.overlap(x)
overlaps <- rev(overlaps)
for (i in 1:length(overlaps)){
v0[[i+8]]$label <- paste(overlaps[[i]], collapse = "\n")
}
grid.newpage()
grid.draw(v0)
我得到以下输出:
关于维恩图的组织我想这样做:
c <- venn(x, simplify = TRUE, small = 0.5, intersections = TRUE)
我使用带有simplify = TRUE 的venn 函数从包gplots() 获得。但是,在 venn 函数中,我似乎无法用标签名称替换计数。我使用了intersections = TRUE,根据参数的描述,它应该有效,但它没有(尽管如果我查看变量c,信息就在那里)。
Logical flag indicating if the returned object should have the attribute
"individuals.in.intersections" featuring for every set a list of individuals
that are assigned to it.
问题:使用VennDiagrampackage,有没有办法与gplots 包中的venn 函数中的simplify 参数完全相同?
问题 2:使用 gplots 包中的 venn 函数,有没有办法显示每个元素的名称而不是元素计数?就像我在“venn.diagram”函数中所做的那样?
提前致谢,
【问题讨论】:
-
我正在尝试用内部标签绘制维恩图,你的问题就是一个很好的例子,我只有 3 个列表,所以我无法让它工作,因为我无法弄清楚你为什么要添加 8 到这一行的索引:
v0[[i+8]]$label?
标签: r venn-diagram