batchPlot.groups: Plot a Set of Curve Groups from a List of Data Groups

Description Usage Arguments Examples

Description

A simple utility method for visualizing a list of data groups.

Usage

1
2

Arguments

data

the data object, could be a list of lists or anything

extract

a function which extracts a list of data elements from each element of data. This list will then be passed on to batchPlot.list.

colors

the colors to be used for the plot

...

Arguments passed on to batchPlot.list

xfun

a function which receives an element from the data list and extracts a vector of x-coordinates from it

yfun

a function which receives an element from the data list and extracts a vector of y-coordinates from it to be plotted as points, or NULL if no points should be plotted (see plotXY)

ffun

a function which receives an element from the data list and extracts a unary function from it to be plotted over the extracted x coordinates, or NULL if no points should be plotted (see plotXF)

plotXY

should the x-y points be plotted (if yfun is not NULL)

widthXY

the line width for points to be plotted (only considered if plotXY is TRUE and yfun is not NULL)

plotXF

should the x-y lines be plotted (if ffun is not NULL)

widthXF

the line width for lines to be plotted (only considered if plotXF is TRUE and ffun is not NULL)

names

the names of the lines to be printed in the legend, or NULL if no legend should be plotted

xlab

the label for the x-axis

ylab

the label for the y-axis

legend

a list of additional parameters to be passed to legend, or NULL to use the default parameters

x.min.lower

a lower bound for the automatically computed x coordinate minimum

x.min.upper

an upper bound for the automatically computed x coordinate minimum

x.max.lower

a lower bound for the automatically computed x coordinate maximum

x.max.upper

an upper bound for the automatically computed x coordinate maximum

y.min.lower

a lower bound for the automatically computed y coordinate minimum

y.min.upper

an upper bound for the automatically computed y coordinate minimum

y.max.lower

a lower bound for the automatically computed y coordinate maximum

y.max.upper

an upper bound for the automatically computed y coordinate maximum

x.add

some additional x coordinates at which the function should be evaluated, or TRUE if the x coordinate minimum and maximum over all data sets should be added as evaluation points

XYType

the type in which the XY data should be plotted, by default "p", i.e., as points

XFType

the type in which the XF data should be plotted, by default "l", i.e., as lines

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
library(plotteR)

# set a random seed for replicability
set.seed(2677);

# the three base functions with the mean parameter values
f <- list(
  list(f=function(x, par) par[1] + par[2]*x + par[3]*x*x + par[4]*x*x*x,
       m=c(1, -0.2, 0.75, -0.3)),
  list(f = function(x, par) par[1] * exp(par[2] - x),
       m=c(0.1, 3)),
  list(f=function(x, par) par[1] + par[2]*sin(par[3]*x),
       m=c(0, 1, 3)));

# create the three example data sets
examples <- lapply(X=f, FUN=function(example) {
# for each example function, plot 4 to 50 instances
  lapply(seq_len(runif(n=1, min=4, max=50)),
# for each instance
         FUN=function(i) {
# randomly choose the x-coordinates
           x <- runif(n=as.integer(round(runif(n=1, min=10, max=200))),
                      min=0, max=3);
           m <- example$m;
# pick parameters which are normally distributed around the suggestion
           par <- rnorm(n=length(m), mean=m, s=0.1*abs(m));
# and construct a function
           fff <- function(x) example$f(x, par);
# and pass this function as result example together with the x values
           list(x=x, f=fff)
         })
});

# plot the original data
batchPlot.groups(examples,
                 names=c("f1", "f2", "f3"),
                 main="Several Groups of Functions",
                 plotXY=FALSE, plotXF=TRUE,
                 legend=list(x="bottom", horiz=TRUE));

thomasWeise/plotteR documentation built on May 29, 2019, 5:41 a.m.