qwr
qwr

Reputation: 10891

Adding y label to dendextend dendrogram

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?

Upvotes: 1

Views: 388

Answers (1)

qwr
qwr

Reputation: 10891

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"))

Upvotes: 1

Related Questions