This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to make cut off linein cluster,

Hi Everyone,

I was trying to draw a cut-off line to 0.02 in the dendrogram, but I could not draw the line.

Kindly please help me.

My R code is as follows-

y=as.matrix(matrix)

hc <- hclust(as.dist(1-cor(y, method="spearman")), method="average")

sampleTree = as.dendrogram(hc, method="average")
plot(sampleTree,
     main = "Sample Clustering",
     ylab = "Height")

cut_avg <- cutree(hc, h = 0.02)

I also attach the dendogram cluster for reference.enter image description here

Thank you!

dendogram cutoff r

1 answer

Try adding the following line of code:

abline(h = .02)

Thank you so much it worked. I highly appreciate your help.

Log in to answer this question.