Debian Codegraph @

R/mult.fig.R

raw
1 mult.fig <-
2 function(nr.plots, mfrow, mfcol,
3 marP = rep(0, 4), mgp = c(if(par("las") != 0) 2. else 1.5, 0.6, 0),
4 mar = marP + 0.1 + c(4,4,2,1), oma = c(0,0, tit.wid, 0),
5 main = NULL, tit.wid = if (is.null(main)) 0 else 1 + 1.5*cex.main,
6 cex.main = par("cex.main"), line.main = cex.main - 1/2,
7 col.main = par("col.main"),
8 font.main = par("font.main"),
9 ...)
10 {
11 ## Purpose: 'MULTiple FIGures' incl. title and other good defaults
12 ## -------------------------------------------------------------------------
13 ## Arguments: -- Either ONE of the first 3 arguments --
14 ### =========> help(mult.fig)
15 ## -------------------------------------------------------------------------
16 ## Author: Martin Maechler, 1990 (UW, Seattle) -- 1995
17 ## -------------------------------------------------------------------------
18
19 use.row <- missing(mfcol)
20 if (use.row)
21 if (missing(mfrow)) {
22 if (missing(nr.plots))
23 stop("must either specify 'nr.plots', 'mfrow' or 'mfcol' !")
24 else mfrow <- n2mfrow (nr.plots)
25 }
26 old.par <-
27 if(use.row) par(mfrow = mfrow, oma = oma, mar = mar, mgp= mgp)
28 else par(mfcol = mfcol, oma = oma, mar = mar, mgp= mgp)
29 ##---- now go ahead :
30 if (!is.null(main)) {# Do title *before* first plot!
31 plot.new()
32 mtext(main, side = 3, outer = TRUE,
33 line = line.main,
34 cex = cex.main,
35 font = font.main, col = col.main, ...)
36 par(new=TRUE)# reverse `plot.new()' above
37 }
38 invisible(list(new.par = par(c("mfrow","mfcol","oma","mar","mgp")),
39 old.par = old.par))
40 }