[R] R help files -> S-Plus; par('mgp')

Paul Murrell paul at stat.auckland.ac.nz
Thu May 10 05:34:49 CEST 2001


Hi


> P.S.  I didn't get any reaction to my proposal to have
> x- and y-axis specific par('mgp') parameters when
> par(las=1).  I hope that R-core will consider that.


My take on this is as follows ...

Doing this would make par() more complex and ...
    (i) par() is quite complex already
    (ii) there is no end to the number of parameters we could put in par()
to control specific aspects such as axis label locations.

I think that a better approach in this sort of case is to use a lower-level
tool to obtain greater control.  In this particular case, axis() or mtext()
will give you the flexibility you need.  The following code hopefully shows
what I mean ...

par(mfrow=c(2,2), mar=c(7,7,2,2), mgp=c(3,1,0), las=1)
  plot(1:10, xlab="", ylab="", main="standard mgp setttings")
  box("figure", lty="dashed")
par(mgp=c(7,3,0))
  plot(1:10, xlab="", ylab="", main="custom mgp settings\nfor both axes")
  box("figure", lty="dashed")
par(mgp=c(3,1,0))
  plot(1:10, xlab="", ylab="", axes=F,
       main="custom mgp settings\njust for the y-axis")
  box()
  axis(1)
  par(mgp=c(7,5,0))
  axis(2)
  box("figure", lty="dashed")
par(mgp=c(3,1,0))
  plot(1:10, xlab="", ylab="", axes=F,
       main="even more custom settings\njust for the y-axis")
  box()
  axis(1)
  axis(2, labels=FALSE)
  mtext(c("Whatever", "I", "Want", "Wherever", "I want it"),
        at=seq(10,2,-2), line=c(7, 7, 1, 4, 4), adj=c(0, 0, 1, .5, .5),
        side=2)
  box("figure", lty="dashed")


Happy to hear opposing arguments  :)

Paul


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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