1
votes

How can I add a y label to a dendrogram produced by dendextend? This may be used to label "Pairwise Distance", for example.

What about for horizontal (ggplot(horiz = T)) dendrograms?

1

1 Answers

1
votes

axis.title.y must be specified in a theme for the text to show up. For example:

dend %>% 
  ggplot() + 
  labs(y = "Pairwise Euclidean Distance") + 
  theme(axis.title.y = element_text(angle = 90))

For horizontal dendrograms, y is specified to labs(), but now we need axis.title.x in theme(). I could only get text to show up by specifying color = "black". Not sure why.

dend %>% 
  ggplot() + 
  labs(y = "Pairwise Euclidean Distance") + 
  theme(axis.title.x = element_text(color = "black"))