Sorry to bother you with such a question. I'm new to R and have tried to figure it out myself for a while, but well. How can I change the scaling of the axis? If for example I have: a<-1:30 plot(a,type="b") The axis is scaled from 1 to 30. plot(a,xlim=c(1,3)) Just shows me the first three entries of a, but not all 30 scaled from 1 to 3 with 0.1 ticks. I guess there must be an easy way to do this, but can't find it. Thanks for your help, Mathias from Berlin -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Wed, Mar 20, 2002 at 05:50:15PM +0100, Mathias Ditzen wrote:> a<-1:30 > plot(a,type="b") > > The axis is scaled from 1 to 30. > > plot(a,xlim=c(1,3)) > > Just shows me the first three entries of a, but not all 30 scaled from 1 > to 3 with 0.1 ticks.There are at least a couple of ways: 1) explicitly state what x-values you want: plot(a ~ seq(1,3,length=30)) 2) draw a custom axis. Check out help(axis). plot(a,xaxt="n") axis(1,at=seq(1,30,length=5),labels=seq(1,3,length=5)) <opinion> 1 is easier, 2 is more flexible </opinion> Cheers Jason -- Indigo Industrial Controls Ltd. 64-21-343-545 jasont at indigoindustrial.co.nz -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Try plot(seq(1, 3, length=length(a)), a) T. On Wed, 2002-03-20 at 11:50, Mathias Ditzen wrote:> Sorry to bother you with such a question. I'm new to R and have tried to > figure it out myself for a while, but well. > How can I change the scaling of the axis? > If for example I have: > > a<-1:30 > plot(a,type="b") > > The axis is scaled from 1 to 30. > > plot(a,xlim=c(1,3)) > > Just shows me the first three entries of a, but not all 30 scaled from 1 > to 3 with 0.1 ticks. > > I guess there must be an easy way to do this, but can't find it. > Thanks for your help, > Mathias from Berlin > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html > Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._