[R] Setting hetmap.2 Color Key Range Outside of Data Limits

Dario Strbenac dstr7320 at uni.sydney.edu.au
Fri Jan 17 07:00:15 CET 2014


There are many questions about making the limit of the colour key smaller than the data range, but I have the opposite problem.

Assume one heatmap has data in the range 6 to 12 and another has data in the range 6 to 9. By providing the same breaks argument to both plots, the heatmaps are coloured as it should be, but for the second heatmap, the range of the colour key is just from 6 to 9. I'd like to force the second colour key to go up to 12 also. How can this be achieved ? My use case is that I have identified a number of clusters in a gene expression dataset, and I would like to avoid plotting them in one large heatmap, but as multiple smaller heatmaps.

Also, unless key = FALSE, having a heatmap with values in only one colour bin causes
Error in axis(1, at = xv, labels = lv) : no locations are finite.

Perhaps this could also be handled more gracefully. I am using R 3.02.

Dario Strbenac
PhD Student
University of Sydney
Camperdown NSW 2050

More information about the R-help mailing list