1

I can create a dendrogram using

x<-1:100
dim(x)<-c(10,10)
set.seed(1)
groups<-c("red","red", "red", "red", "blue", "blue", "blue","blue", "red", "blue")
x.clust<-as.dendrogram(hclust(dist(x)))

x.clust.dend <- x.clust
labels_colors(x.clust.dend) <- groups
x.clust.dend <- assign_values_to_leaves_edgePar(x.clust.dend, value = groups, edgePar = "col") # add the colors.
x.clust.dend <- assign_values_to_leaves_edgePar(x.clust.dend, value = 3, edgePar = "lwd") # make the lines thick
plot(x.clust.dend) 

However I want to delete the scale of height information in the left as shown in Figure below. enter image description here My guess is that it should be extremely trivial but I am not able to find a way to do this. One solution which I don't want is using the ggplot2 as below:

ggplot(as.ggdend(dend2))

This is because I will loose some of the formatting like color_bars()

Community
  • 1
  • 1
discipulus
  • 2,665
  • 3
  • 34
  • 51

2 Answers2

4

The graphical parameter 'axes = FALSE" can be used to remove the distance measure for the plot.dendogram command:

plot(x.clust.dend, axes=F)

This will produce the following dendogram without distance axis:

enter image description here

Tal Galili
  • 24,605
  • 44
  • 129
  • 187
Adam Quek
  • 6,973
  • 1
  • 17
  • 23
2

You can just set yaxt = "n"

plot(x.clust.dend, yaxt = "n") 

You can add another axis with

axis(side = 2, labels = FALSE)
Richard Telford
  • 9,558
  • 6
  • 38
  • 51