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

John Maindonald e980153 at leonard.anu.edu.au
Wed Feb 2 05:26:35 CET 2000


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.

[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).]

John Maindonald
john.maindonald at anu.edu.au

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