When I plot the dendrogram using "as.dendrogram" all the leaf labels are cut. See those linked images below as examples:
When I plot using "hclust" (all labels showing correctly) Dendrogram 1
When I plot using "as.dendrogram" Dendrogram 2
Codes:
The data I created just to show the problem
test <- matrix(c(34,34,32,27,12,1,2,1,1,1), ncol=2)
colnames(test) <- c('Variable1', 'Variable2')
rownames(test) <- c('African Forest Elephant', 'Asian Domestic Elephant','African White Rhino','West African Giraffe','African Mountain Gorilla')
test_table <- as.table(test)
To plot the first linked image
hctest = hclust(dist(test_table))
plot(hctest, axes = FALSE)
The second one
hctest = as.dendrogram(hctest)
plot(hctest, edge.root = TRUE, horiz = TRUE)
PS: If I use "horiz = FALSE" the same problem persists. I tried exporting the image and also tried using R markdown, but nothing changes.