Hello. I was wondering how one can find the exact values of the range of an axis within a plot. In xlispstat it was (send plot :range 0). Thanks much, Jason
Hope this helps. Jerome> plot(0:1,0:1) > par()$usr[1] -0.04 1.04 -0.04 1.04 On Monday 24 February 2003 11:06, Jason Bond wrote:> Hello. I was wondering how one can find the exact values of the range of > an axis within a plot. In xlispstat it was (send plot :range 0). Thanks > much, > > Jason > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > http://www.stat.math.ethz.ch/mailman/listinfo/r-help
Jason Bond wrote:> Hello. I was wondering how one can find the exact values of the range > of an axis within a plot. In xlispstat it was (send plot :range 0). > Thanks much,After you have created the plot try par("usr"). This gives 4 values: xmin, xmax, ymin, ymax. > plot(1:10, 1:10) > par("usr") [1] 0.64 10.36 0.64 10.36 -- Ross Ihaka Email: ihaka at stat.auckland.ac.nz Department of Statistics Phone: (64-9) 373-7599 x 85054 University of Auckland Fax: (64-9) 373-7018 Private Bag 92019, Auckland New Zealand
Hi, ----- Original Message ----- From: "Jason Bond" <jbond at arg.org> To: <R-help at stat.math.ethz.ch> Sent: Tuesday, February 25, 2003 8:06 AM Subject: [R] exact range of axes in plots> Hello. I was wondering how one can find the exact values of the range of > an axis within a plot. In xlispstat it was (send plot :range 0). Thanksmuch, Is xlim and ylim in the plot() what you want? For example: > x <- rnorm(100) > plot(x) > plot(x, xlim = c(20, 80), ylim = c(-2, 2)) the second plot() will restrict the range of x-axis to be between 20 and 80, y-axis between -2, 2. Cheers, Kevin
>-----Original Message----- >From: r-help-admin at stat.math.ethz.ch >[mailto:r-help-admin at stat.math.ethz.ch] On Behalf Of Jason Bond >Sent: Monday, February 24, 2003 1:06 PM >To: R-help at stat.math.ethz.ch >Subject: [R] exact range of axes in plots > > >Hello. I was wondering how one can find the exact values of >the range of >an axis within a plot. In xlispstat it was (send plot :range >0). Thanks much, > > JasonSee ?par Specifically par("usr"), which will give you the actual range of the x and y axes. par("xaxp") or par("yaxp") will also give you information on the axis tick marks. Be aware that the above pars are altered when log scales are used, so be sure to read the help file carefully in that situation. If you want to SET the axis ranges explicitly, most of the plotting functions take the arguments 'xlim' and 'ylim', which can be used for that purpose. HTH, Marc Schwartz
Dear Jason, par("usr") will give you what you want. John At 11:06 AM 2/24/2003 -0800, Jason Bond wrote:>Hello. I was wondering how one can find the exact values of the range of >an axis within a plot. In xlispstat it was (send plot :range 0). Thanks much, > > Jason > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >http://www.stat.math.ethz.ch/mailman/listinfo/r-help____________________________ John Fox Department of Sociology McMaster University email: jfox at mcmaster.ca web: http://www.socsci.mcmaster.ca/jfox