简体   繁体   中英

how to plot hclust objects up to certain number of cuts?

I try to plot an hclust object. The plot looks ok but I would like to have a plot that doesn't go all the way down but stops at 5 cuts. I tried ylim but this doesn't change anything to the plot. My code is

library(datasets)
    data <- iris
dist <- dist(data, method= "euclidean")
hclust <- hclust(dist, method = "complete")
plot(hclust, ylim=4:8)

here you can find the answer to your question Plotting hclust only to the cut clusters, not every leaf

hclust <- cut(hclust, h = 100)
plot(hclust2$upper)

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