1

I have a heatmap and want to create shared labels for multiple columns, i.e. a label for columns 1 and 2 and a label for columns 3 and 4 (or any combination of columns). Is this possible with heatmap.2?

Current plot: See here for the plot in question

Desired output: Desired output

Joe
  • 8,073
  • 1
  • 52
  • 58
Tom Nash
  • 13
  • 6

1 Answers1

1

Yep. Pass a vector containing NAs to the labCol argument to skip the labels that you need. Then just adjust adjCol to get the desired result. You might have to mess around a bit with these parameters, but it's easily doable. For example:

mat <- matrix(rnorm(40), ncol=4)
labvec <- c("B",NA,"A",NA)

library(gplots)
heatmap.2(mat, trace=c("none"), labCol = labvec, adjCol = c(1,4.5)) 

enter image description here

Joe
  • 8,073
  • 1
  • 52
  • 58