R: Partitions plot space into rectangular grid

splitplot {ifultools} | R Documentation

## Partitions plot space into rectangular grid

### Description

Uses the `plt` argument of the `par` function to divide the space according to the input grid.

### Usage

    splitplot(nrows, ncols, i=1, new=as.logical(i > 1 && i <= nrows*ncols), gap=0.15)

### Arguments

`nrows` | an integer defining the number of desired rows in the plot grid.
`ncols` | an integer defining the number of desired column in the plot grid.
`gap` | a numeric scalar used a nudge factor for the gap between plots in both the x- and y-directions. Default: `0.15`.
`i` | selects the `i`th plot of the current `nrow` by `ncol` plot grid for the next plot. The upper left plot region is denoted by `i=1` and increments moving from left to right, then top to bottom. Default: `1`.
`new` | a logical flag. If `TRUE`, a new plot grid is established and previously defined plot regions are erases. Default: `as.logical(i > 1)`.

### Value

the original `plt` value of the `par` function prior to the call. The user can use this to reset `plt` to its original values.

### Note

The `plt` option of the `par` function is altered.

### See Also

`stackPlot`.

### Examples

    ## establish a 2x2 plot grid and select the first
    ## for plotting
    old.plt <- splitplot(2,2,1)

    ## plot the data
    for (i in seq(4)){
        if (i > 1)
           splitplot(2,2,i)

        plot(rnorm(100)*i)
        mtext(paste("i=", i, sep=""), side=3, line=0.5)
    }

    ## return the original plot state of plt in par
    par(old.plt)

[Package ifultools version 2.0-19 Index]