[R] axis

Uwe Ligges ligges at statistik.uni-dortmund.de
Sun Dec 15 11:30:04 CET 2002


Myriam Abramson wrote:
> 
> I have to draw a phase space graph. Is it possible to draw the axis at
> the center at (0,0)?

Yes, using axis() with argument "pos", see ?axis. 

Example:

 y <- rnorm(21)
 plot(-10:10, y, axes=FALSE)
 axis(1, pos=0)
 axis(2, pos=0)

 # OK. Looks ugly (the zero). Next try:
 plot(-10:10, y, axes=FALSE) 
 axis(1, pos = 0, at = c(-10, -5, 5, 10))
 yprt <- pretty(y)
 yprt <- yprt[yprt != 0]
 axis(2, pos = 0, at = yprt)


Uwe Ligges




More information about the R-help mailing list