Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在R中的无根树中隐藏一些标签_R_Plot_Ape - Fatal编程技术网

如何在R中的无根树中隐藏一些标签

如何在R中的无根树中隐藏一些标签,r,plot,ape,R,Plot,Ape,我正在使用R软件包ape绘制系统发育树。我对显示的一些标签不感兴趣(例如,“CAN”,见下图),有些标签重叠(例如,“B10”、“D1”或“D3”)。这样做的目的是:(1)找到一种方法来防止某些标签被显示,或者(2)减小字体大小以使标签更具可读性 下面是我用来绘制树的代码: library(ape) arbol <- nj(as.dist(Matrix_Distance)) plot.phylo(arbol, type = "unrooted", edge.wid

我正在使用R软件包
ape
绘制系统发育树。我对显示的一些标签不感兴趣(例如,“CAN”,见下图),有些标签重叠(例如,“B10”、“D1”或“D3”)。这样做的目的是:(1)找到一种方法来防止某些标签被显示,或者(2)减小字体大小以使标签更具可读性

下面是我用来绘制树的代码:

library(ape)    
arbol <- nj(as.dist(Matrix_Distance))
        plot.phylo(arbol, type = "unrooted", edge.width = 1, font = 1,lab4ut = "axial", show.tip.label = TRUE, cex = 0.5)
根据(第195页),您可以通过调整参数
cex
(这是一个比例因子,默认值取决于图形参数的当前值,并且可能因用户而异)来调整树上显示的字体大小:

一个数值,给出尖端和节点标签的因子缩放(字符扩展)。默认设置是从图形参数中获取当前值

要删除某些标签,最简单的方法可能是在打印之前删除(或隐藏)不希望显示的样本的相应列/行。根据文档,事实上,
show.tip.label
是一个布尔值:

指示是否在系统发育图上显示tip标签的逻辑值(默认为TRUE,即显示标签)

根据(第195页),您可以通过调整参数
cex
(这是一个比例因子,默认值取决于图形参数的当前值,并且可能因用户而异)来调整树上显示的字体大小:

一个数值,给出尖端和节点标签的因子缩放(字符扩展)。默认设置是从图形参数中获取当前值

要删除某些标签,最简单的方法可能是在打印之前删除(或隐藏)不希望显示的样本的相应列/行。根据文档,事实上,
show.tip.label
是一个布尔值:

指示是否在系统发育图上显示tip标签的逻辑值(默认为TRUE,即显示标签)


试着分两步做。首先是没有尖端的树

plot.phylo(arbol, type = "unrooted", edge.width = 1, font = 1,lab4ut = "axial", show.tip.label = FALSE)
然后把小费放在树上

## Creating the vector of labels
my_labels <- tree$tip.label
## "Removing" the unwanted labels (e.g. label 1, 2 and 7)
my_labels[c(1,2,5)] <- ""
## Adding the labels
tiplabels(my_labels, cex = 0.5)
创建标签向量
我的标签试着分两步来做。首先是没有尖端的树

plot.phylo(arbol, type = "unrooted", edge.width = 1, font = 1,lab4ut = "axial", show.tip.label = FALSE)
然后把小费放在树上

## Creating the vector of labels
my_labels <- tree$tip.label
## "Removing" the unwanted labels (e.g. label 1, 2 and 7)
my_labels[c(1,2,5)] <- ""
## Adding the labels
tiplabels(my_labels, cex = 0.5)
创建标签向量 我的标签