[R] heatmap.2 - change column & row locations; angle / rotate

Karl Brand k.brand at erasmusmc.nl
Mon Apr 18 18:23:12 CEST 2011

Hi Chakravarthy,

[dont forget to Cc the list for useRs with the same Q.]

If you're trying to reuduce the isze of your row or column labels, i 
think the following arguments of heatmap.2 {gplots} is what you want to 
adjust- 'cexCol' and 'cexRow'.

Specifically on my question that you ask about, i found the BioC forum 


And in fact the phylotemp() function by default pretty much did exactly 
what i needed, available here:


However, it was pointed out to me  that some times the best way to get 
it just right is using more basic functions, which for heatmaps would be 
image(). See:




On 04/18/2011 10:38 AM, chakri2sai at yahoo.co.in wrote:
> Dear Karl Brand,
> I am facing same problem as you have faced before (see appended mail below). I am writing to you to find out whether you have found a solution !
> I asked a similar question in R-forum (http://r.789695.n4.nabble.com/How-to-save-heatmap-as-image-or-pdf-td3412542.html#a3413871).
> Any pointers would be greatly appreciated
> Thanks
> Chakravarthy
> Junior Research Fellow
> Tata Institute of Fundamental Research
> Bangalore, India
> <quote author='Karl Brand'>
> Esteemed R user's,
> I'm struggling to achieve some details of a heatmap using heatmap.2():
> 1. Change label locations, for both rows&  columns from the default
> right&  bottom, to left and top.
> Can this be done within heatmap.2()? Or do i need to suppress this
> default behavior (how) and call a new function to relabel (what)
> specifying locations?
> 2. Change the angle of the labels.
> By default column labels are 90deg anti-clock-wise from horizontal. How
> to bring them back to horizontal? Or better, rotate 45deg clock-wise
> from horizontal (ie., rotate 135deg a.clock.wise from default)?
> Any suggestions or pointers to helpful resources greatly appreciated,
> Karl

Karl Brand <k.brand at erasmusmc.nl>
Department of Genetics
Erasmus MC
Dr Molewaterplein 50
3015 GE Rotterdam
P +31 (0)10 704 3455 | F +31 (0)10 704 4743 | M +31 (0)642 777 268

More information about the R-help mailing list