Re: [R] Adding name labels to x-axis of matplot

From: Dimitris Rizopoulos <dimitris.rizopoulos_at_med.kuleuven.be>
Date: Wed, 26 Mar 2008 12:37:22 +0100

try this:

dat <- matrix(rnorm(20), 10, 2)
dimnames(dat) <- list(1:10, c("sample1", "sample2"))

matplot(dat, pch = 16, xaxt = "n", col = 1:2,

    ylab = "Expression Value")
axis(1, at = 1:10, labels = paste("Gene", 1:10), cex.axis = 0.7)

I hope it helps.

Best,
Dimitris



Dimitris Rizopoulos
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium

Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


> Hello,
>
> I have a gene expression matrix with columns being samples and rows
> being genes. I would like to display the expression values for each
> gene. I have two groups which I colour differently. The aim is to
> see
> if there is any difference between the two groups consistently
> across genes.
>
> So the following works well:
>
> matplot(as.matrix(nonormexpr),pch=16,col=c(rep(1,length(left)),rep(2,length(right))),cex=0.4)
>
> The only thing is that the x-axis has numbers 1 ... 10, whereas I
> would
> like to give them the names of the genes. I have tried using the
> "labels" parameter but I get:
>
> Error in axis(side, at, as.graphicsAnnot(labels), tick, line, pos,
> outer, :
> 'labels' is supplied and not 'at'
>
> Any ideas? Is there are a more appropriate plot type?
>
> --
> **************************************************************
> Daniel Brewer, Ph.D.
> Institute of Cancer Research
> Molecular Carcinogenesis
> Email: daniel.brewer_at_icr.ac.uk
> **************************************************************
>
> The Institute of Cancer Research: Royal Cancer Hospital, a
> charitable Company Limited by Guarantee, Registered in England under
> Company No. 534147 with its Registered Office at 123 Old Brompton
> Road, London SW7 3RP.
>
> This e-mail message is confidential and for use by the...{{dropped:14}}



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 26 Mar 2008 - 11:40:08 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 26 Mar 2008 - 12:30:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive