[R] Scatterplot axes
Thomas W Blackwell
tblackw at umich.edu
Wed Dec 10 15:02:03 CET 2003
Ellen -
plot(my.x.vector, my.y.vector, xlim=c(-3,3), ylim=c(-3,3))
It's the named arguments xlim and ylim that you were looking for.
I frequently set them as xlim = 3 * c(-1,1), ylim = 3 * c(-1,1)
so that I can change the range by editing just one number rather
than two. For an added fillip, try adding the argument asp=1.
This will extend the range of one axis or the other by just
enough so that the graphical scale is the same on both axes,
that is, a one unit increase is the same number of millimeters
on the horizontal and the vertical axes. It's very cool. It
does, completely automatically, what I used to do painstakingly
by trial and error, tinkering with the width of the top and side
margins, until the graphical scales were equal.
- tom blackwell - u michigan medical school - ann arbor -
On Wed, 10 Dec 2003, Ellen Kalmbach wrote:
> Please, could someone help me figure out what seems to be a very simple
> problem (and is still taking me hours...).
> I want to draw a simple scatterplot but with 'equal' axes, i.e. I want both
> axes to go from -3 to 3. Values for x lie between -2 and 0.5, values for y
> between -2.2 and 3. I have tried 'usr' and 'eqscplot' and a few other
> options, but it doesn't give me the desired result.
> Many thanks!!!
> Ellen
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
More information about the R-help
mailing list