简体   繁体   中英

Rstudio: plot a horizontal dendrogram without the labels at the same level

I want to do a hierarchical cluster and then get the horizontal plot without the labels at same level.

My code:

dim(bin_mat) # 53194   519    
data = bin_mat[,1:10]
names(data) = seq(1:10)
mydist.jacc <- vegdist(t(data), method = "jaccard")    
myhclust <- hclust(mydist.jacc,method='average')   
plot(myhclust,main = "Genome Clustering")

在此处输入图片说明

Basically, I want the last plot but in the horizontal without the labels at the same level.

I tried this command, but the labels are in the same level.

plot(as.dendrogram(myhclust), horiz = TRUE)

在此处输入图片说明

Since you didn't provide your dataset, I used the "USArrets". I believe you will understand what you need to do based on the code below.

data(USArrests)
dd <- dist(scale(USArrests), method = "euclidean")
myhclust <- as.dendrogram(hclust(dd, method = "average"))
plot(myhclust,  xlab = "Height", horiz = TRUE)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM