5.5 years ago by
On 10/2/2012 6:59 PM, Alyaa Mahmoud wrote:
> Hi All
> I am trying to generate a heatmap for a matrix of 360 rows and 11
> I need the row labels to be readable from within the heatmap by
> so. I use heatmap.2 function but when I decrease cexRow to any value
> than 0.06, the labels just disappear, i.e. they don't get any
> also tried the margins argument within heatmap.2 function but this
> solve the problem.
> Any help with this regards ??
I have rarely found the need to set the cexCol argument, and have
that the better idea is to make the resulting image of the right
dimensions. I assume here that you are creating a heatmap with lots of
rows, and comparatively speaking, much fewer columns. If you don't
specify the dimensions of the output, then you will get a square-ish
heatmap with really thin rows that are hard to label.
If instead, you specify that the heatmap will be a really tall thin
object, then you get something closer to what you are likely
in. Try something like this:
pdf("tmp.pdf", width = 8, height = 200) ## you may need to play with
heatmap.2(as.matrix(bb), scale="row", key=TRUE, symkey=FALSE,
density.info="none", trace="none", cexCol=0.2, dendrogram="both",
You can use jpeg(), png(), etc, but note that those are raster
that won't scale without becoming pixellated, whereas pdfs are vector
graphics that will scale well. If you are on windows you might
win.metafile() as well, but in my experience the column labels get
mis-placed more often than not (being put right on top of the lower
portion of the heatmap). So I tend to stick with pdfs.
If you need something square-ish for e.g., a publication, then the
won't be legible anyway. In that case it seems to me that most people
just forgo row labels altogether.
> heatmap.2(as.matrix(bb), scale="row", key=TRUE, symkey=FALSE,
> trace="none", cexRow=0.06, cexCol=0.2, dendrogram="both", Rowv=rowv,
> Thanks a lot
James W. MacDonald, M.S.
University of Washington
Environmental and Occupational Health Sciences
4225 Roosevelt Way NE, # 100
Seattle WA 98105-6099