3

I am relatively new to R and am trying to use heatmap.2(). I have found it to be a great tool, except there is one detail that is driving me crazy. The tick marks in the legend do not line up perfectly with the colors I assign in the breaks.

Below is a minimal working example. In the legend the green area goes significantly over 1, however the bottom left portion of the heatmap (value = 1.0001) is blue as I specified in the breaks. I am using RStudio Version 0.99.486 if that makes a difference. Please help!

library(gplots)

M <- matrix(c(0.5,1.0001,2.1,3.9),nrow=2)

my_palette <- c('green','blue','purple','orange')
heatmap.2(M,Colv=NULL,Rowv=FALSE,dendrogram=NULL,trace='none',density.info='none',
          breaks=c(0,1,2,3,4),
          col=my_palette,
          key.xlab='',key.title='')
C8H10N4O2
  • 18,312
  • 8
  • 98
  • 134
nate2113
  • 31
  • 2
  • related question: http://stackoverflow.com/questions/23613866/heatmap-2-and-color-key-tick-marks – C8H10N4O2 Dec 17 '15 at 15:38
  • I was able to replicate your problem... on my screen it looks like the tick marks are equally spaced and the green color block is too big. I don't know this package well enough to help. If nobody else helps you, you can try filing an issue on https://github.com/cran/gplots – C8H10N4O2 Dec 17 '15 at 15:52
  • I can't reproduce your problem, in my case the plot renders as expected, it would be helpful to see your plot – Alf Pascu Dec 19 '20 at 21:55

0 Answers0