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

Karl Brand k.brand at erasmusmc.nl
Sun Jul 25 17:04:17 CEST 2010


Cheers Amos,

 From this post response its clear there's no simple way to do this with 
available R heatmap functions. And with your example in hand can plow on 
and hopefully get a workable solution. Thanks alot for this!

Karl



On 7/23/2010 3:16 PM, Amos Folarin wrote:
> Hi Karl,
> The only way I know to rotate the labels is pretty crude. You will have to reconstitute the labels using the text() function.
> The caveat here is you'll have to play around to get this right.
>
> Try something like this:
>
> Library(gplots)
> x<- matrix(rnorm(25), 5)
> heatmap.2(x, labRow="", labCol="") #remove the labels
> # plot the text, perhaps someone can think of a smarter way of getting the labels in position...
> text(seq(par("xaxp")[1]+par("xaxp")[2]/par("xaxp")[3], par("xaxp")[2], by=0.8*(par("xaxp")[2]/par("xaxp")[3])),par("usr")[3], par("usr")[3] - 0.2, labels = c("first", "second", "third", "fourth", "fifth"), srt = 45, pos = 1, xpd = TRUE)
>
> Unfortunatetly the heatmap is laid out in a 2x2 matrix with the dendrograms and key in the first 3 cells and the heatmap in the bottom right -- I'm not sure if it is possible to access the axes of this element independently. If one could then it might make positioning the labels for the heatmap moiety of the plot simple.
>
>
>
> Amos
>
>
>
> -----Original Message-----
> From: bioconductor-bounces at stat.math.ethz.ch [mailto:bioconductor-bounces at stat.math.ethz.ch] On Behalf Of bioconductor-request at stat.math.ethz.ch
> Sent: 23 July 2010 11:00
> To: bioconductor at stat.math.ethz.ch
> Subject: Bioconductor Digest, Vol 89, Issue 22
>
> Send Bioconductor mailing list submissions to
> 	bioconductor at stat.math.ethz.ch
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	https://stat.ethz.ch/mailman/listinfo/bioconductor
> or, via email, send a message with subject or body 'help' to
> 	bioconductor-request at stat.math.ethz.ch
>
> You can reach the person managing the list at
> 	bioconductor-owner at stat.math.ethz.ch
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Bioconductor digest..."
>
>
> Today's Topics:
>
>     1. heatmap.2 - change column&  row locations; angle  / rotate
>        (Karl Brand)
>     2. In limma, how to set quility weight for each spot. (Jinyan Huang)
>     3. Re: In limma, how to set quility weight for each spot.
>        (Sean Davis)
>     4. Re: exonmap/xmapcore error (Crispin Miller)
>     5. Heatmap.2 scale problems: Sacling inside the function gives
>        different results than scaling outside!!! (Elmer Fern?ndez)
>     6. Re: exonmap/xmapcore error (Crispin Miller)
>     7. Re: Heatmap.2 scale problems: Sacling inside the function
>        gives different results than scaling outside!!! (Sean Davis)
>     8. ShortRead QA (Alex Gutteridge)
>     9. Re: Heatmap.2 scale problems: Sacling inside the	function
>        gives different results than scaling outside!!! (Bazeley, Peter)
>    10. Re: Heatmap.2 scale problems: Sacling inside the	function
>        gives different results than scaling outside!!! (Benjamin Otto)
>    11. Biostrings - vcountPattern optimization (Erik Wright)
>    12. Re: Biostrings - vcountPattern optimization (Steve Lianoglou)
>    13. problem about hgu133plus2 annotation (Gina Liao)
>    14. Re: Heatmap.2 scale problems: Sacling inside the function
>        gives different results than scaling outside!!! (Elmer Fern?ndez)
>    15. Re: problem about hgu133plus2 annotation (Marc Carlson)
>    16. Re: problem about hgu133plus2 annotation (James W. MacDonald)
>    17. Re: Biostrings - vcountPattern optimization (Patrick Aboyoun)
>    18. Re: feature request - pairwiseAlignment() in Biostrings
>        (Patrick Aboyoun)
>    19. Re: Biostrings - vcountPattern optimization (Erik Wright)
>    20. Re: feature request - pairwiseAlignment() in Biostrings
>        (Michael Lawrence)
>    21. Re: Heatmap.2 scale problems: Sacling inside the function
>        gives different results than scaling outside!!! (Steve Lianoglou)
>    22. Re: Biostrings - vcountPattern optimization (Herv? Pag?s)
>    23. Re: Heatmap.2 scale problems: Sacling inside the function
>        gives different results than scaling outside!!! (Elmer Fern?ndez)
>    24. Re: Heatmap.2 scale problems: Sacling inside the function
>        gives different results than scaling outside!!! (Sean Davis)
>    25.  the design matrix again (Gordon K Smyth)
>    26. Open Postdoc Positions (Thomas Girke)
>    27. Re: htQPCR (Heidi Dvinge)
>    28. Re: Problem with function limmaCtData in HTqPCR package:
>        "leading minor of order 2 is not positive definite" (Heidi Dvinge)
>    29. building a refseq-based transcriptDb: warnings of interest?
>        (Vincent Carey)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 22 Jul 2010 12:18:16 +0200
> From: Karl Brand<k.brand at erasmusmc.nl>
> To: bioconductor at stat.math.ethz.ch
> Subject: [BioC] heatmap.2 - change column&  row locations; angle  /
> 	rotate
> Message-ID:<4C481AE8.7060701 at erasmusmc.nl>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> <Reposting from "r-help at r-project.org">
>
> Esteemed BioC 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
Department of Genetics
Erasmus MC
Dr Molewaterplein 50
3015 GE Rotterdam
T +31 (0)10 704 3457 |F +31 (0)10 704 4743 |M +31 (0)642 777 268



More information about the Bioconductor mailing list