Hi experts I woul like to change my x-axis. Like this: 10,...,2,...,1 I am using this code: r<-c(1:10) plot(r, axes=FALSE, frame.plot=TRUE,xlim=c(10,1)) axis(1,at=10/seq(1:10)) axis(2, at=axTicks(2), axTicks(2)) but my x-sxis i still: 1,..., 2,...,10 What should I do? [[alternative HTML version deleted]]
On 05/06/2014 07:07 PM, Babak Bastan wrote:> Hi experts > > I woul like to change my x-axis. Like this: 10,...,2,...,1 > > I am using this code: > > r<-c(1:10) > plot(r, axes=FALSE, frame.plot=TRUE,xlim=c(10,1)) > axis(1,at=10/seq(1:10)) > axis(2, at=axTicks(2), axTicks(2)) > > but my x-sxis i still: 1,..., 2,...,10 >Hi Babak, I get x axis ticks at 10, 5, 3.33333, ... with the above code, which is expected. I think you want something like: plot(1:10,axes=FALSE,frame.plot=TRUE) axis(1,at=1:10,labels=10/seq(1:10)) What you have done is interesting. By specifying xlim=c(10,1) you have reversed the order of whatever labels you pass to the "axis" function. Jim
On Tue, 6 May 2014 09:07:55 +0000 Babak Bastan <babakbsn at gmail.com> wrote> Hi experts > > I woul like to change my x-axis. Like this: 10,...,2,...,1 > > I am using this code: > > r<-c(1:10) > plot(r, axes=FALSE, frame.plot=TRUE,xlim=c(10,1)) > axis(1,at=10/seq(1:10)) > axis(2, at=axTicks(2), axTicks(2)) > > but my x-sxis i still: 1,..., 2,...,10 > > What should I do? > > [[alternative HTML version deleted]] > > ______________________________________________ > 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.at and R prompt: ?axis # read the help page - especially in relation to labels .. plot(...) axis(1,at=10/seq(1:10), labels = 10:1) .. ____________________________________________________________ South Africas premier free email service - www.webmail.co.za Cheapest Insurance Quotes! https://www.outsurance.co.za/insurance-quote/personal/?source=msn&cr=Postit14_468x60_gif&cid=322