mayplot: Matrix-like Plot for Arrays up to Rank 5

View source: R/graphics.R

mayplotR Documentation

Matrix-like Plot for Arrays up to Rank 5

Description

Produces a matrix-like plot for arrays up to rank 5, using grid and gridBase which allows traditional graphics, optionally via a user specified panel function panel.

Usage

mayplot(x, vList, row.vars = NULL, col.vars = NULL,
        xvar, method = if(has.n.sim) "boxplot" else "lines",
       panel.first = NULL, panel.last = NULL,
       type = "l", pch = NULL, ylim = "global",
       log = "", do.legend = TRUE,
       spc = c(0.04/max(1,n.x-1), 0.04/max(1,n.y-1)),
       axlabspc=c(0.12, 0.08), labspc=c(0.04, 0.04),
       n.sim.spc = 0.06, auxcol = c("gray40", "gray78", "gray90", "white"),
       pcol = c("black", "blue", "red", "orange"), grid.lwd = 1.6, ax.lwd = 2,
       tx.cex = 1.2, leg.cex = 1, xlab = NULL, ylab = NA,
       do.n.sim = has.n.sim,
       verbose = getOption("verbose"), show.layout = verbose, ...)

Arguments

x

numeric array of ‘rank’ 5, i.e., length(dim(x)) == 5, with named dimnames; typically resulting from a call like getArray(doMclapply(..)).

vList

a list of variable specifications, see varlist and mkGrid.

row.vars

a dimension name of x, a string; this variable is plotted in the plot rows.

col.vars

a dimension name of x, a string; this variable is plotted in the plot columns.

xvar

dimension name of x, a string; this variable is plotted on the x axis of each sub-plot.

method

character string indicating the plot method used. Currently available are "boxplot" (the default if vList has n.sim) or "lines" (otherwise; type adjusts the type of lines used).

panel.first, panel.last

function or NULL (default). If specified, panel.first(x, y, col, ...) is called before and panel.last(x, y, col, ...) is called after the main plotting functions (think boxplot.matrix() and lines()) are called in each panel.

type

character indicating the type of plotting in the non-boxplot case; actually any of the types as in plot.default.

pch

logical indicating whether a plot symbol is to be used in the legend (default NULL determines this from type).

ylim

either string "global", "local", or a numeric vector, as for plot.default.

log

logical indicating if logarithmic scales should be used (in the individual plots).

do.legend

logical indicating if a legend should be added.

spc

dimensions (x, y) in “npc” for the space between sub-plots. The default uses a simple adaption to the number of sub-plots in each direction.

axlabspc

vector of length two containing the width of the y axis label and the height of the x axis label in “npc”.

labspc

vector of length two containing the width of the box of the row labels and the height of the box of the column labels in “npc”.

n.sim.spc

space for n.sim on the bottom right of the plot in “npc” (only if available).

auxcol

auxiliary colors; vector with four components:

  1. color of axes and ticks

  2. background color for the row and column labels

  3. background color for the plots

  4. color of grid lines

pcol

plot base colors. If more colors than the provided ones are required, colorRampPalette() is used.

grid.lwd

lwd for grid

ax.lwd

lwd for axes

tx.cex

cex for row and column labels

leg.cex

cex of legend text and n.sim if appropriate

xlab

x axis label (spanned over all plot columns); when NULL, the default is vList[[xvar]]$expr; to suppress, use NA.

ylab

y axis label (spanned over all plot rows): Typically a label for the "value" of the simulation.

do.n.sim

logical indicating whether n.sim is displayed on the bottom right of the plot (only if available).

verbose

logical indicating whether more information is displayed during plotting.

show.layout

logical indicating whether the grid layout is displayed.

...

optional arguments passed to panel().

Value

the layout, invisibly.

Author(s)

Marius Hofert and Martin Maechler.

See Also

matplot unit and grid.layout from package grid.

Examples

vLis <-
 varlist(d = list(type="grid", value = c(10, 100, 1000)),
         family=list(type="grid", value = c("Clayton", "Gumbel")),
         tau = list(type="grid", value = c(0.25, 0.5)),
         alpha = list(type="inner", value = c(0.95, 0.99, 0.999)))

iP <- c(4, 1:3)# <- permutation, putting alpha first
dNms <- mkNms(vLis)[iP]
## an array as from  x <- getArray( doMclapply(vLis, ..) ) :
x <- array(
    c(6.1981, 8.0478, 8.4265, 46.883, 74.359, 86.4394, 432.585, 743.27, 859.35,
      4.8508, 6.0286, 6.3965, 26.380, 35.132, 47.1517, 243.113, 311.36, 342.84,
      7.8546, 8.9769, 9.2199, 78.235, 89.493, 92.2875, 785.674, 893.63, 923.62,
      7.7164, 8.2866, 8.8169, 75.959, 82.806, 88.0626, 756.786, 831.65, 874.70),
    dim = sapply(dNms, length), dimnames = dNms)

mayplot(x, vLis, row.vars="family", col.vars="tau", xvar="alpha", log="y",
       ylab=bquote(widehat(VaR)[alpha]))
## the same, but no xlab and no ylab :
mayplot(x, vLis, row.vars="family", col.vars="tau", xvar="alpha", log="y", xlab=NA)





simsalapar documentation built on April 27, 2023, 9:05 a.m.