系统发育树R中的绘图点

Drawing points in phylogenetic tree R

我想在第一个节点上只画一个点,然后在第一个尖端再画一个。到目前为止,我可以画点,但只能一次画出所有点,而且我找不到单独画点的方法。我目前拥有的:

library(ape)
t3 = '((a:1,b:1):1,(c:1.5,d:0.5):0.5):1;'
plot(read.tree(text = t3),root.edge=T)
nodelabels(pch=21, col="black", adj=1, bg='blue', cex=2) 

感谢任何帮助

这不是确切答案,但应该有所帮助。我通过查看 nodelabels 函数的代码得到了这个。

library(ape)
t3 = '((a:1,b:1):1,(c:1.5,d:0.5):0.5):1;'
plot(read.tree(text = t3),root.edge=T)

lastPP <- get("last_plot.phylo", envir = .PlotPhyloEnv)
node <- (lastPP$Ntip + 1):length(lastPP$xx)
XX <- lastPP$xx[node]
YY <- lastPP$yy[node]
BOTHlabels(text="", node, XX[1], YY[1], adj = c(0.5, 0.5), 
frame = "rect", pch = 21, thermo = NULL, pie = NULL, 
piecol = NULL, col = "blue", bg = "blue", 
horiz = FALSE, width = NULL, height = NULL, cex=2)

XX 和 YY 给出了节点。在这里,我只使用第一个。您必须为小费做的事情也是类似的。查看 tiplabels 的代码。

您可以在 nodelabels 函数中使用“node”参数定义要绘制到哪个节点,对于 tiplabels 函数也是如此,但使用“tip”参数。 所以:

library(ape)
t3 = '((a:1,b:1):1,(c:1.5,d:0.5):0.5):1;'
tree <- read.tree(text = t3)
first_node <- length(tree$tip.label)+1
plot(tree, root.edge=T)
nodelabels(node = first_node, pch=21, col="black", bg='blue', cex=2)
tiplabels(tip = 1, pch=21, col="black", bg='blue', cex=2)