[R] axis function

Ben Bolker ben at zoo.ufl.edu
Fri May 26 00:02:23 CEST 2000


On Thu, 25 May 2000 zivan.karaman at limagrain.com wrote:

> In S-PLUS, the 'axis' function accepts some arguments that don't exist
> in the R counterpart.
> 
> The two that I'm interested in right now are 'pos' and 'ticks'.
> 
> Any suggestions on how obtain the same result with R?
> 

Good news and bad news.
The good news: you can pass any graphics parameter to 'axis', including
"tck" (tick length--if set to zero this eliminates ticks) and "mgp" (which
is a three-place vector that sets the position of axis title, labels, and
lines respectively).

The bad news: only the second element of mgp (label position) seems to
have any effect (R 1.0.0, RH 6.0).  This looks like a couple of bugs ...

## examples

par(mfrow=c(2,2))
## ticks on y-axis but not x-axis
plot(c(0,1),c(0,1),axes=FALSE)
axis(side=1,tck=0)
axis(side=2)

## attempt to move x-title in toward plot, doesn't work
plot(c(0,1),c(0,1),axes=FALSE)
axis(side=1,mgp=c(1,1,1),labels=FALSE)
axis(side=2,lwd=2)

## move x-labels away from plot
plot(c(0,1),c(0,1),axes=FALSE)
axis(side=1,mgp=c(1,4,1))
axis(side=2,lwd=2)

## try to move x-axis line, doesn't work
plot(c(0,1),c(0,1),axes=FALSE)
axis(side=1,mgp=c(1,1,4))
axis(side=2,lwd=2)

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list