[R] I want axes that cross

Paul Johnson pauljohn32 at gmail.com
Fri Feb 13 21:22:52 CET 2009

On Fri, Feb 13, 2009 at 1:42 PM, Daniel Moreira <daniel.moreira at duke.edu> wrote:
> Try defining the argument 'pos' in the axis command-line, like:
> x <- rnorm(100)
> z <- gl(2,50)
> y <- rnorm(100, mean= 1.8*as.numeric(z))
> plot(x,y,type="n", axes=F)
> points(x,y, pch="$",cex=0.7, col=z)
> axis(1, col="green", col.axis="green", pos=0)
> axis(2, col="red", col.axis="red", pos=-2)
> ________________________________________
> Daniel Moreira, MD

If you actually ran that code and still suggest it as the fix, then I
think you must be joking.  Pushing the axes into the middle of the
data cloud in order to make them cross is certainly not making a very
nice looking plot. Not only are there observations outside the area
framed by the axes, but there are axis labels that are overlapped by
observations and by the axes themselves.


Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas

More information about the R-help mailing list