[R] how to save a heatmap.2 in png /jpeg /tiff

Fred frederic.stadler at unifr.ch
Mon Sep 10 09:48:44 CEST 2012


Thanks everyone for your comments and help.
Actually, I found my mistake (probably stupid for y'all). I was drawing
first the heatmap and then putting the 
>png("heatmap.2.png").

What you have to do is :
>a<- read.csv (".... .csv)
>a_matrix <- data.matrix (a)
>row.names(a_matrix) <-a$Name # In my case I wanted to have the name from
the column Name...
>a_matrix <-a_matrix [,2:5] # To delete the first column containing the
Name.
>library(gplots)
>png("heatmap.2.png", width= 10000, height = 10000, units = "px",
bg="white")
>heatmap.2(a_matrix, Rowv=NA, Colv = NA, col= topo.colors(250),
scale=column, margins=c(7,10), trace="none", density.info=c("none"))


The only problem I have now, is taht I get a nice png file of 2Mb, but I
can't read the name of the genes anymore.!!
2 questions : 
1) Do I need to play with the "pointsize =  " 
2) What is the higher quality picture I can make ? When I try with more
pixels "R " tends to crash... 

THANKS

Fred



--
View this message in context: http://r.789695.n4.nabble.com/how-to-save-a-heatmap-2-in-png-jpeg-tiff-tp4642607p4642641.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list