[R] Re: Outer margin (oma) settings for pairs()

Prof Brian D Ripley ripley at stats.ox.ac.uk
Wed Feb 2 09:07:43 CET 2000


On Wed, 2 Feb 2000, John Maindonald wrote:

> I propose the following small changes to pairs.default.
> The point is to allow control of the outer margin settings,
> so that there is for example room for legends.

John:

We've just hit feature freeze for 0.99.0 (due Feb 7, at least
in source form).  As this seems minor, I have put it in
(plus a comment on the help page).

Brian

> 
> [Note also the issue re the setting of par()$usr on exit]
> 
> ----------------------------------------------------------------
> (1) Replace
> function (x, labels, panel = points, main = NULL, font.main =
> par("font.main"), 
>     cex.main = par("cex.main"), ...) 
> 
> with:
> 
> function (x, labels, panel = points, main = NULL, font.main =
> par("font.main"), 
>     cex.main = par("cex.main"), oma=NULL, ...) 
> (i. e. add the named parameter oma)
> 
> ----------------------------------------------------------------
> (2) Replace lines 16-19, i. e.
> 
>  oma <- c(4, 4, 4, 4)
>     if (!is.null(main)) 
>         oma[3] <- 6
>     opar <- par(mfrow = c(nc, nc), mar = rep(0.5, 4), oma = oma)
> 
> with the following:
> 
> if(is.null(oma)){
>     oma <- c(4, 4, 4, 4)
>     if (!is.null(main)) 
>         oma[3] <- 6}
>     opar <- par(mfrow = c(nc, nc), mar = rep(0.5, 4), oma = oma)
> 
> ----------------------------------------------------------------
> 
> A related issue has to do with the user co-ordinates [par()$usr]
> that are left in place after exiting from pairs().  The user
> co-ordinates seem to be determined by the range for the 
> variable whose name appears in the bottom panel on the right, 
> i. e. the final variable in the data frame.  They apply however
> to the whole plot region.  The on.exit(par(opar)) resets other
> parameters, but not par()$usr, which remain at the setting
> used for the final panel.  One can of course interrogate
> par()$usr for purposes of placing a legend, but it would
> surely make more sense to reset par()$usr to c(0,1,0,1)?
> [Note also that for using legend() to put legends in the margins,
> one needs par(xpd=T).]

I think this is consistent with all multi-plot layouts. You should
only use the usr coordinates for the current plot, in that case the last
one drawn.  It would seem strange for pairs.default to be an exception
(and c(0,1,0,1) is not a user coordinate system for anything, as far as I
can see).

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

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