The function heatmap() allows to specify row/column labels
via the options labRow/labCol. From the code of heatmap(),
I understand that when no labels are specified, the row/column
labels (or indices) of the input matrix are taken as labels and
re-ordered together with the rows and columns of the matrix before
plotting, whereas labels supplied via labRow/labCol are plotted
in the original order.
Code from heatmap(), R 1.8.1:
x <- x[rowInd, colInd]
if (is.null(labRow))
labRow <- if (is.null(rownames(x)))
(1:nr)[rowInd]
else rownames(x)
if (is.null(labCol))
labCol <- if (is.null(colnames(x)))
(1:nc)[colInd]
else colnames(x)
...
axis(1, 1:nc, labels = labCol, las = 2, line = -0.5, tick = 0,
cex.axis = cexCol)
axis(4, iy, labels = labRow, las = 2, line = -0.5, tick = 0,
cex.axis = cexRow)
To see an example, try
a <- matrix(c(1,1,1,2,0,2), nrow=3)
rownames(a) <- 1:3
x11()
heatmap(a)
x11()
heatmap(a, labRow=rownames(a))
Is this really meant to work like this? - From
the help of heatmap(), one might expect also user-supplied
labels to be re-ordered together with the rows and
columns of the matrix.
Cheers,
Anja
--
Dr. Anja von Heydebreck
Max Planck Institute for Molecular Genetics
Dept. Computational Molecular Biology
Ihnestr. 73
14195 Berlin, Germany
heydebre at molgen.mpg.de phone: +49-30-8413-1168
http://www.molgen.mpg.de/~heydebre fax: +49-30-8413-1152