Hi I am trying to plot two points (with confidence intervals) on a graph to illustrate the value of a particular quantity after 1 and 2 iterations respectively. I'm doing this by plot(cycle,alpha[2,],main="",ylim=c(-8,-3),cex=2,col="red",pch=19,ylab=e xpression(alpha),xlab="cycle") Etc.. Where> cycle[1] 1 2> alpha[,1] [,2] [1,] -6.227266 -5.762146 [2,] -5.200972 -5.010401 [3,] -4.174677 -4.258655 When I plot this I get the x-axis scale reading 1.0,1.1,1.2,...,2.0 I want to get it to read simply 1 2 Is there an easy way to do this?
try the following: plot(..., xaxt = "n") axis(1, at = 1:2) I hope it helps. Best, Dimitris ---- Dimitris Rizopoulos Ph.D. Student 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://www.med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm ----- Original Message ----- From: "Bowden, J.M." <jmb56 at leicester.ac.uk> To: <r-help at stat.math.ethz.ch> Sent: Thursday, March 02, 2006 4:41 PM Subject: [R] Graphics question> > Hi > > I am trying to plot two points (with confidence intervals) on a > graph to > illustrate the value of a particular quantity after 1 and 2 > iterations > respectively. > > > I'm doing this by > > plot(cycle,alpha[2,],main="",ylim=c(-8,-3),cex=2,col="red",pch=19,ylab=e > xpression(alpha),xlab="cycle") > > Etc.. > > Where > > >> cycle > [1] 1 2 >> alpha > [,1] [,2] > [1,] -6.227266 -5.762146 > [2,] -5.200972 -5.010401 > [3,] -4.174677 -4.258655 > > > When I plot this I get the x-axis scale reading 1.0,1.1,1.2,...,2.0 > > I want to get it to read simply 1 2 > > > Is there an easy way to do this? > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html >Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
xaxp=c(1,2,1) will do so, and look also at par(lab=). On Thu, 2 Mar 2006, Bowden, J.M. wrote:> > Hi > > I am trying to plot two points (with confidence intervals) on a graph to > illustrate the value of a particular quantity after 1 and 2 iterations > respectively. > > > I'm doing this by > > plot(cycle,alpha[2,],main="",ylim=c(-8,-3),cex=2,col="red",pch=19,ylab=e > xpression(alpha),xlab="cycle") > > Etc.. > > Where > > >> cycle > [1] 1 2 >> alpha > [,1] [,2] > [1,] -6.227266 -5.762146 > [2,] -5.200972 -5.010401 > [3,] -4.174677 -4.258655 > > > When I plot this I get the x-axis scale reading 1.0,1.1,1.2,...,2.0 > > I want to get it to read simply 1 2 > > > Is there an easy way to do this? > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595