我正在使用cophyloplot创建两个系统发育树的缠结图。该方法适用于小型树木,但是当树木变大时,输出图像将保持相同的大小,我找不到扩展它的方法。
下面是运行良好的一棵小树的代码(与以下示例基本相同:https : //www.rdocumentation.org/packages/ape/versions/5.4-1/topics/cophyloplot):
library(ape)
#two random trees
TreeA <- rtree(10)
TreeB <- rtree(10)
#creation of the association matrix:
association <- cbind(TreeB$tip.label, TreeB$tip.label)
cophyloplot(TreeA, TreeB, assoc = association, length.line = 4, space = 28, gap = 3)
小树代码将产生以下内容:
但是当我使用较大的树时,它们变得不可读。例如,使用具有100个技巧的树将导致:
无法读取笔尖标签。如何扩展渲染以便可读?
缠结函数带有许多选项,可以改善您获得的图像的输出(尤其是参数lab.cex和margin_inner)。尽管最大的因素可能是纠结图的外部因素,并且是图形设备的大小(通过dev.new),所以在此处使用宽度和高度可能会解决大多数问题
这是一个简单的自包含代码,显示了如何使用这些选项来获得良好的输出。
########
## Nice example of some colored trees
# see the coloring of common sub trees:
set.seed(23235)
ss <- sample(1:150, 100)
dend1 <- iris[ss, -5] %>%
dist() %>%
hclust("com") %>%
as.dendrogram()
dend2 <- iris[ss, -5] %>%
dist() %>%
hclust("sin") %>%
as.dendrogram()
dend12 <- dendlist(dend1, dend2)
# dend12 %>% untangle %>% tanglegram
dev.new(width=5, height=4)
dend12 %>% tanglegram(common_subtrees_color_branches = TRUE,
lab.cex = .5, margin_inner = 1.3)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句