gmGeostats (version 0.10-6)

swarmPlot: Plot a swarm of calculated output through a DataFrameStack

Description

Take a DataFrameStack() and apply a certain plotting function to each elements of the stack. The result (typically a curve per each stack element), may then be plotted all together

Usage

swarmPlot(
  X,
  MARGIN = stackDim(X),
  PLOTFUN,
  ...,
  .plotargs = list(type = "l"),
  .parallelBackend = NA
)

Arguments

X

a DataFrameStack() or anaologous object

MARGIN

which dimension defines the stack? it has a good default! change only if you know what you do

PLOTFUN

the elemental calculating function; this must take as input one element of the stack and return as output the (x,y)-coordinates of the calculated curve for that element, in a list of two elements

...

further parameters to PLOTFUN

.plotargs

either a logical, or else a list of graphical arguments to pass to plot.swarmPlot(); if .plotargs=FALSE no plot is produced; if .plotargs=TRUE a plot with default values is produced;

.parallelBackend

NA or a parallelization strategy; currently unstable for certain operations and platforms.

Value

Invisibly, this function returns a list of the evaluation of PLOTFUN on each element of the stack. If .plotargs other than FALSE, then the function calls plot.swarmPlot() to produce a plot.

Examples

Run this code
# NOT RUN {
dm = list(point=1:100, var=LETTERS[1:2], rep=paste("r",1:5, sep=""))
ar = array(rnorm(1000), dim=c(100,2,5), dimnames = dm)
dfs = DataFrameStack(ar, stackDim="rep")
swarmPlot(dfs, PLOTFUN=function(x) density(x[,1]))
# }

Run the code above in your browser using DataCamp Workspace