Another alternative is:

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",xaxp=c(-6, 3, 9),xpd=T)
axis(2, col="red", col.axis="red", yaxp=c(-6, 6, 12),xpd=T)

________________________________________
Daniel Moreira, MD

Research Associate
Duke University Medical Center
DUMC 2626, MSRB-I Room 455
571 Research Drive
Durham, North Carolina 27710
Telephone: (919) 681-7132
Fax: (919) 668-7093
E-mail: daniel.moreira@duke.edu




David Winsemius <dwinsemius@comcast.net> 
02/13/2009 03:47 PM

To
Paul Johnson <pauljohn32@gmail.com>
cc
Daniel Moreira <daniel.moreira@duke.edu>, R-help 
<r-help@stat.math.ethz.ch>
Subject
Re: [R] I want axes that cross






I think you ought to worry a bit about who might be laughing at whom. 
You are asking for a plot with rather unnatural behavior and 
potentially very misleading to the audience. Here it is, but you bear 
full responsibility for any consequences:

plot(x,y,type="n", axes=F, xlim=c(min(x)-1, max(x)), 
ylim=c(min(y)-1,max(y)))
points(x,y, pch="$",cex=0.7, col=z)
axis(1, col="green", col.axis="green",pos=-1)
axis(2, col="red", col.axis="red", pos=-2.5)

-- 
David Winsemius

On Feb 13, 2009, at 3:22 PM, Paul Johnson wrote:

> On Fri, Feb 13, 2009 at 1:42 PM, Daniel Moreira <daniel.moreira@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.
>
> PJ
>
> -- 
> Paul E. Johnson
> Professor, Political Science
> 1541 Lilac Lane, Room 504
> University of Kansas
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



	[[alternative HTML version deleted]]


