2

I have a dendrogram with leaf and node labels (class=phylo, read in using read.tree). After converting this to dendrogram class the node labels are not there anymore. However, I would like to plot the dendrogram by showing labels on top of some nodes (i.e in the form NODE_1 etc. on top of the selected clusters).

Does anyone know how can I get node labels to dendrogram class and add them to the plot? Something similar like this, but instead of numbers there are id-s or labels and only some selection of nodes have the labels.

enter image description here

Liis Kolberg
  • 153
  • 12
  • You could use `get_nodes_xy` but I'm not sure how to manage the logic of how to store and tell each node what to plot. – Tal Galili Oct 21 '17 at 08:20

1 Answers1

0

I would convert your dendrogram to phylo class with as.phylo. When plotting you can do plot(phylo, show.node.label = TRUE).

patL
  • 2,259
  • 1
  • 17
  • 38
  • Thank You for the suggestion, but it seems that plotting as phylo doesn't show the scales, not so easy to plot horizontally and also I'm not sure that I can use color_branches() with this class. – Liis Kolberg Oct 20 '17 at 09:50
  • 1
    @Liis Kolberg You can color your phylo branches with `edge.color` and set the colors you want. With the function `add.scale.bar` you can plot your scale. – patL Oct 20 '17 at 09:56