arrayplot {heR.Misc}R Documentation

Plot a multi-dimensional array

Description

Function to plot the values of an array against selected values (i.e., indices) of an independent variable for selected values of a third (key) variable and selected values of the remaining (conditioning) variables.

Usage

arrayplot(a, i, k,
          r, ival, kval, sel.i, sel.k,
          r.integ=NULL, integ=FALSE, FUN=sum,
          col, lty, lwd, pch, axes=TRUE,
          legend=FALSE, man.leg=FALSE, ncol=1, idx.leg=TRUE,
          main.leg=paste("Key Variable, k=",k,sep=""),
          xlim=NULL, ylim=NULL, type="l", log="",
          pretty=TRUE, grid=FALSE,
          main=NULL, xlab=NULL, ylab=NULL, new=TRUE,
          dup.top=FALSE, persp=FALSE, theta=55, phi=27, p.col=7,
          p.box=TRUE, expand=0.5, shade=0.50, border=NA,
          ltheta=-135, lphi=0, level=FALSE, image=FALSE, nlevels=25)

Arguments

a is a multi-way array
i is the dimension index of the independent variable
ival is a vector containing all the actual values of i
k is the dimension index of the key variable
kval is a vector containing all the actual values of k
sel.k is a vector giving the indices of k that will be plotted
sel.i is a vector of the indices of i that will be plotted
r is a vector containing the indices for the remaining variables in a. Note: By default they are set to 1
r.integ is a list giving the indices for each of the remaining variables over which a will be integrated, iff integ=TRUE. If duplicate indices are given they will be used to weight the corresponding array values by the number of duplicates. If integ=FALSE, then the plots will be conditioned on the single values for the remaining variables given in r
integ logical, whether to integrate the remaining variables or not
FUN is the function applied to the selected remaining variable values. Default is sum
col gives the colors that correspond to each index of the key variable k in sel.k
lty, lwd, pch plotting line style, width, and symbol style
Note: If too few values are given for colors and plotting symbols, they are recycled
axes logical, whether to plot axes or not
legend logical, whether to include a legend or not
man.leg logical, manual specify legend position or not
ncol number of columns in the legend
idx.leg logical, whether to include indices in the legend or not
main.leg main title for the legend
xlim,ylim x-axis and y-axis limits
type type of plotting symbol, recycled
log log axis specification, e.g., "x" or "y" or "xy"
pretty logical, pretty tics for axes or not
grid logical, draw gridlines or not
main, ylab, xlab the titles and axis labels for the plot
new If new=TRUE then a plot.new() function call is issued before drawing the graph
dup.top logical, if TRUE the top array value for the i indices is duplicated. The function then expects an additional value for ival too, if the largest sel.i index is the maximum index. If the largest sel.i index is not the maximum possible, then the ival is that corresponding to the next highest index. A warning is issued if ival is smaller than the number of i indices plus 1, and an NA is introduced if there is no ival available. Note: This dup.top feature is used to include the absolute maximum value on aerosol size distribution plots.
persp If new=TRUE, then draw a perspective (3D) plot (instead of a 2D plot with multiple series for the k variable values)
theta azimuthal angle for perspective plot
phi colatitude angle for perspective plot
p.col color of perspective plot
p.box logical, draw a box for perspective plot or not
expand expansion factor for perspective plot
shade shade value for perspective plot
border border color for perspective plot
ltheta light azimuthal angle for perspective plot
lphi light colatitude angle for perspective plot
image If image= TRUE, then draw a "3D" R image plot (or "level" plot) with the array values designated by differently colored blocks
nlevels number of levels for image plot
level If level=TRUE, then draw a level plot, which is similar to the image plot except that contours are drawn instead of blocks and a key is provided next to the plot.

Details

If integ = TRUE, then the array values are *integrated* over the remaining variables' indices given in the list r.integ instead of conditioned on the *single* indices for each of the remaining variables given in r. Instead of integration (summing), another function FUN can be specified.

If persp = TRUE, then a perspective (3D) plot will be produced, or if image = TRUE then a 3D R image plot will be produced, or if level=TRUE then a level plot and key will be drawn, otherwise a 2D figure is produced that has series corresponding to every index in array dimension k.

The array values are plotted in "index order".

Note. This function allows for the convenient exploration of a multi-way array without requiring any conversion. Instead of using this function to visualize multi-variate data, it might be better to use the powerful Trellis graphics, which are available in the lattice R package. Trellis graphics require conversion of the array to a dataframe object. See a2df.

Value

Invoked for the side effect of producing a plot.

Author(s)

Neil E. Klepeis
neil AT exposurescience DOT org
http://klepeis.net

See Also

a2df, Lattice


[Package heR.Misc version 0.0.4 Index]