jorismeys at gmail.com
2009-Nov-25 16:15 UTC
[Rd] heatmap.2 gives wrong colorkey with unequally spaced breaks (PR#14085)
Full_Name: Joris FA Meys Version: 2.10.0 OS: Windows XP Submission from: (NULL) (157.193.194.73) I use the enhanced heatmap function in gplots : heatmap.2 For the presentation of the color key, the code is not 100% adequate. More specifically, in case you define unequally spaced breaks : 1) the keyplot ignores the minimum and maximum of these breaks. Code changed in line 323 and 324 to : min.raw <- min(c(x,breaks), na.rm = TRUE) max.raw <- max(c(x,breaks), na.rm = TRUE) 2) the keyplot gives the histogram with the correct breaks, but the colors remain equally spaced. This is due to the lack of a specification for x in the call to the image() function. Code changed in line 327-328 to : image(x=breaks,z = matrix(z, ncol = 1), col = col, breaks = tmpbreaks, xaxt = "n", yaxt = "n") Line numbers obtained by copy-pasting code from console into Tinn-R. The changed code is how I adapted the function in order to get the desired result. Don't know if it's error-proof, but it works for me. Cheers Joris