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 ----- Original Message ----- From: "Daniel Brewer" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, March 26, 2008 12:10 PM Subject: [R] Adding name labels to x-axis of matplot > 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: [EMAIL PROTECTED] > ************************************************************** > > 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@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.