Re: [R] Scatterplot with corner at (0, 0)

From: Jim Lemon <bitwrit_at_ozemail.com.au>
Date: Wed 08 Feb 2006 - 12:51:46 EST


Thomas L Jones wrote:

 >

> I have two vectors, x and y, and I want to create a scatterplot. I
> want the lower left corner to be at (0, 0). I can create a scatterplot
> just by calling plot (x, y), but I am quite throroughly stymied and
> frustrated by the problem of putting the lower left corner at (0, 0),
> despite many tries.

plot(x,y,xlim=c(0,max(x)),ylim=c(0,max(y)),xaxs="i",yaxs="i")

You may want to leave a bit of extra room at the higher values either like this:

xlim=c(0,1.05*max(x))

or by using an arbitrary value that is above the maximum:

ylim=c(0,5)

Jim



R-help@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 Received on Tue Feb 07 20:54:30 2006

This archive was generated by hypermail 2.1.8 : Wed 08 Feb 2006 - 03:32:15 EST