[BioC] Row labels in a heatmap
Dan Du
tooyoung at gmail.com
Mon Jul 16 16:09:42 CEST 2012
Hi Liat,
I think you have to first run heatmap once, get the order of rows in the
graph and feed the corresponding rows with the right name and leave
others empty, in order to keep a regular interval between names.
# example from ? heatmap
x <- as.matrix(mtcars)
rc <- rainbow(nrow(x), start=0, end=.3)
cc <- rainbow(ncol(x), start=0, end=.3)
hv <- heatmap(x, col = cm.colors(256), scale="column",
RowSideColors = rc, ColSideColors = cc, margins=c(5,10),
xlab = "specification variables", ylab= "Car Models",
main = "heatmap(<Mtcars data>, ..., scale = \"column\")")
# create a new name vector for the plot
nn<-rep('', nrow(x))
nn[hv$rowInd[seq(1,nrow(x), 10)]]<-rownames(x)[hv$rowInd[seq(1,nrow(x),
10)]]
# plot again with the desired row names 'labRow'
heatmap(x, col = cm.colors(256), scale="column",labRow=nn,
RowSideColors = rc, ColSideColors = cc, margins=c(5,10),
xlab = "specification variables", ylab= "Car Models",
main = "heatmap(<Mtcars data>, ..., scale = \"column\")")
Hth,
Dan
On Mon, 2012-07-16 at 16:42 +0300, Liat Shavit Grievink wrote:
> Hi James,
> Thank you!
> The thing is that I rather not have numbers 1 to 500, but for example:
> 1, 100, 200, 300,400, 500. or something like this (so show a label
> only every 100 genes).
> Thanks again,
> Liat.
> On 16.07.2012, at 16:24, James W. MacDonald wrote:
>
> > row.names(yourmatrix) <- seq(1, nrow(yourmatrix),1)
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
More information about the Bioconductor
mailing list