Is it a bug or an intended behavior of rect.dendrogram()
function in dendextend
? Below is a demonstration code. First build a very simple dendrogram:
library(dendextend)
dend <- 1:5 %>% dist %>% hclust %>% as.dendrogram
Then plot it with h = 3
:
plot(dend)
rect.dendrogram(dend, h = 3)
The resulted tree is:
And my question is how the h
parameter should be interpreded? In the help file you can read that h
Cuts the dendrogram by cutting at height h. Therefore, I would expect two rectangles to be drawn because at height h = 3
the tree should be splited into 2 clusters, as I mark manually in the drawings below: