1

I used heatmap.2(mat, Colv = TRUE, Rowv = TRUE) to create a heatmap and got this: enter image description here

I have a group of vectors: c("a","d"), c("b","c","e"),c("f","g") and I want to allocate different color to each group, so that each member of a specific group in the dendogram will be colored in the specific color of its group.

user2026
  • 61
  • 1
  • 11
  • I think THIS will be useful for you https://stackoverflow.com/questions/29265536/how-to-color-the-branches-and-tick-labels-in-the-heatmap-2 – pali May 23 '18 at 14:50
  • Thanks. But the difference is that I can't choose the color for each column, just for the whole cluste, and I want to divide the colores by vectors that represent the columns. @pali – user2026 May 23 '18 at 22:30
  • Is [this](https://bioconductor.org/packages/release/bioc/vignettes/ComplexHeatmap/inst/doc/s6.heatmap_decoration.html) what you're trying to do? Or do you want the heatmap itself to have different colours for different groups? – heathobrien May 24 '18 at 05:51
  • No. I want diffrent colors for different groups (that I will choose). @heathobrien – user2026 May 24 '18 at 12:27
  • @user2026 That's clear. What I'm trying to figure out is what part of the plot are you trying to colour. The heatmap? The dendrogram? A strip between the heatmap and the column names? Something else? – heathobrien May 24 '18 at 15:29
  • The dendogram @heathobrien – user2026 May 24 '18 at 19:30
  • In that case the solution linked by @pali will work for you. You just need to use the `branches_attr_by_labels` function from `dendextend` – heathobrien May 24 '18 at 20:02

0 Answers0