[R] I want axes that cross

David Winsemius dwinsemius at comcast.net
Fri Feb 13 21:46:59 CET 2009


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 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.
>
> PJ
>
> -- 
> Paul E. Johnson
> Professor, Political Science
> 1541 Lilac Lane, Room 504
> University of Kansas
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list