[R] Plot

Marc Schwartz MSchwartz at mn.rr.com
Wed Dec 7 13:56:48 CET 2005


On Wed, 2005-12-07 at 18:08 +1100, paul sorenson wrote:
> Apple Ho wrote:
> > Hello,
> > 
> > I have a problem about using the command "plot". Suppose I have some
> > points, and one of them is (0,0), how can I show the figure with this
> > point which is at the corner?
> 
> How close to the corner do you want it?
> 
>  > plot(0, 0, xlim=c(0, 1), ylim=c(0,1))
> you could also add:
>  > grid()

By default, R adds +/- 4% to each axis range, based upon the range of
the x and y values or the 'xlim' and 'ylim' arguments. 

This behavior is set by pars 'xaxs' and 'yaxs', which are set to "r" by
default. Setting both to "i" will provide exact axis ranges.

Note the difference between:

 plot(0:5, 0:5)

and

 plot(0:5, 0:5, xaxs = "i", yaxs = "i")

See ?par for more information.

HTH,

Marc Schwartz




More information about the R-help mailing list