ggplot2 for Cluster analysis (non-readible row names)

I have made a cluster analysis and ended up with dendrogram; however the row names are not readible (made a red rectangle). May I ask if there is way to adjust it?

library(reshape2)
library(purrr)
library(dplyr)
library(dendextend)
dendro - as.dendrogram(aggl.clust.c)
dendro.col - dendro %%
  set(branches_k_color, k = 5, value =   c(darkslategray, darkslategray4, darkslategray3, gold, gold2)) %%
  set(branches_lwd, 0.6) %%
  set(labels_colors, 
      value = c(darkslategray)) %% 
  set(labels_cex, 0.5)
ggd1 - as.ggdend(dendro.col)
ggplot(ggd1, theme = theme_minimal()) +
  labs(x = Num. observations, y = Height, title = Dendrogram, k = 5)

Topic agglomerative ggplot2 r clustering

Category Data Science


Try adding theme to your plot layout

So:

library("reshape2")
library("purrr")
library("dplyr")
library("dendextend")
dendro <- as.dendrogram(aggl.clust.c)
dendro.col <- dendro %>%
  set("branches_k_color", k = 5, value =   c("darkslategray", "darkslategray4", "darkslategray3", "gold", "gold2")) %>%
  set("branches_lwd", 0.6) %>%
  set("labels_colors", 
      value = c("darkslategray")) %>% 
  set("labels_cex", 0.5)
ggd1 <- as.ggdend(dendro.col)
ggplot(ggd1, theme = theme_minimal()) + theme(text = element_text(size=20)+
  labs(x = "Num. observations", y = "Height", title = "Dendrogram, k = 5")

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.