R: Stack plot

stackPlot {ifultools} | R Documentation

## Stack plot

### Description

Plots input data as a stack of plots.

### Usage

    stackPlot(x, y = NULL, xlty = NULL, bty = "n", lty = 1, col = 1:8,
        lwd = 1, rescale = TRUE, add = FALSE, cex = 1, xaxs = "r", xpd = TRUE,
        yaxis = list(add = TRUE, ndigit = 3,
        col = 1:8, lty = 1, lwd = 3, side = "left", cex = 1),
        xlab = list(text = "", cex = 1, srt = 0, col = 1), ylab = list(text = NULL,
        cex = 1, srt = 0, col = 1:8, side = "right"), main = list(text = "",
        cex = 1, srt = 0, col = 1, adj = 0.5), ylim = NULL)

### Arguments

`x` | a vector of numeric values corresponding to a common abscissa (x-axis) for all ordinate (y-axis) values.
`y` | a numeric vector, matrix, data.frame, or rectangular list containing the ordinate (y-axis) values.
`add` | a logical value. If `TRUE`, the plot is added using the current `par` layout. Otherwise a new plot is produced. Default: `FALSE`.
`bty` | a character string defining the box type (ala `par`'s `bty` parameter) for each plot. Default: `"n"` (no boxes).
`cex` | a numeric value defining the character expansion for the plot labels (ala `par`'s `cex` parameter). Default: 1.
`col` | an integer or vector of integers denoting the color of each plotted series (ala `par`'s `col` parameter). This input can be a vector, one color for each series plotted. If the length of this vector is less than the number of series, then `col` is repeated as many times as necessary. Default: `1:8`.
`lty` | the line type for each plot (ala `par`'s `lty` parameter). This input can be a vector, one line type for each series plotted. If the length of this vector is less than the number of series, then `lty=1` is used for those plots where lty is not directly specified. Default: 1.
`lwd` | an integer or vector of integers denoting the line width of each plotted series (ala `par`'s `lwd` parameter). This input can be a vector, one line width for each series plotted. If the length of this vector is less than the number of series, then `lwd` is repeated as many times as necessary. Default: 1.
`main` | the main label as defined by a list of the following named objects: text A character string defining the label. Default: `""` (no label). cex A character expansion value used to scale the label. Default: 1. srt A numerical value specifying the rotation of the label in degrees. Default: 0. col An integer defining the color of the label. Default: 1. adj A numeric value on [0,1] defining the justification of the label relative to the entire width of the plot window. The value 0, 0.5, and 1 represent left, center, and right text alignment, respectively. Default: 0.5. If a partial list of the above named objects is supplied, those objects are merged with the default list defined above.
`rescale` | a logical value. If `TRUE`, the data in each plot is scaled so that visually the height of each subplot is approximately the same (the y-axis labels denote the unscaled/original values. Default: `TRUE`.
`xaxs` | a character string defining the style of the x-axis interval calculation (ala `par`'s `xaxs` parameter). Default: `"e"` (extended axes).
`xlab` | the x-axis label as defined by a list of the following named objects: text A character string defining the label. Default: `""` (no label). cex A character expansion value used to scale the label. Default: 1. srt A numerical value specifying the rotation of the label in degrees. Default: 0. col An integer defining the color of the label. Default: 1. If a partial list of the above named objects is supplied, those objects are merged with the default list defined above.
`xlty` | the line type (ala `par`'s `lty` parameter) of horizontal lines used to separate stacked plots. Default: `NULL` (no separator lines).
`xpd` | a character string defining the style of the plot clipping (ala `par`'s `xpd` parameter). Default: `TRUE`.
`yaxis` | the y-axis style as defined by a list of the following named objects: add A logical value. If `TRUE`, a y-axis is drawn for each plot. Default: `TRUE`. ndigit An integer defining the number of digits to use in labeling y-axis data ranges. Default: 3. lwd An integer defining the line width of the y-axis. Default: 3. side A character string (either `"left"` or `"right"` denoting the side to place the y-axis. Default: `"left"`. cex A character expansion value used to scale the labels on the y-axis. Default: 1. If a partial list of the above named objects is supplied, those objects are merged with the default list defined above.
`ylab` | the y-axis label(s) as defined by a list of the following named objects: text A (vector of) character string(s) defining the label(s). Default: the names of the y-axis labels as labeled in the primary `y` input. cex A character expansion value used to scale the label(s). Default: 1. srt A numerical value specifying the rotation of the label(s) in degrees. Default: 0. col A (vector of) integer(s) defining the color of the label(s). Default: `1:8`. side A character string (either `"left"` or `"right"` denoting the side to place the y-axis label(s). Default: `"right"`. If a partial list of the above named objects is supplied, those objects are merged with the default list defined above.
`ylim` | a two-element numeric vector containing the y-axis range of each series to plot. The range of the specified `ylim` values must span that of all the series, otherwise an error is returned. Default: `NULL` (y-axis limits are calculated automatically).

### Value

no output.

### Note

A stack plot is produced.

### See Also

`splitplot`.

### Examples

    ## stack-plot the sunspots series and a random
    ## walk series
    set.seed(100)
    ix <- seq(2048)
    stackPlot(x=ix,
        y=data.frame(sunspots[ix], cumsum(rnorm(length(ix)))),
        xlty=2, ylab=list(text=c("sunspots","walk")))

[Package ifultools version 2.0-4 Index]