plot.multiFunData: Plotting multivariate functional data

View source: R/plotMethods.R

plot.multiFunDataR Documentation

Plotting multivariate functional data

Description

This function plots observations of multivariate functional data on their domain. The graphic device is split in a number of subplots (specified by dim) via mfrow (par) and the univariate elements are plotted using plot.

Usage

## S3 method for class 'multiFunData'
plot(
  x,
  y,
  obs = seq_len(nObs(x)),
  dim = seq_len(length(x)),
  par.plot = NULL,
  main = names(x),
  xlab = "argvals",
  ylab = "",
  log = "",
  ylim = NULL,
  ...
)

## S4 method for signature 'multiFunData,missing'
plot(x, y, ...)

Arguments

x

An object of class multiFunData.

y

Missing.

obs

A vector of numerics giving the observations to plot. Defaults to all observations in x. For two-dimensional functions (images) obs must have length 1.

dim

The dimensions to plot. Defaults to length(x), i.e. all functions in x are plotted.

par.plot

Graphic parameters to be passed to the plotting regions. The option mfrow is ignored. Defaults to NULL. See par for details.

main

A string vector, giving the title of the plot. Can have the same length as dim (different titles for each dimension) or length 1 (one title for all dimensions). Defaults to names(x).

xlab, ylab

The titles for x- and y-axis. Defaults to "argvals" for the x-axis and no title for the y-axis for all elements. Can be supplied as a vector of the same length as dim (one x-/y-lab for each element) or a single string that is applied for all elements. See plot for details.

log

A character string, specifying the axis that is to be logarithmic. Can be "" (non-logarithmic axis), "x", "y", "xy" or "yx". Defaults to "" for all plots. Can be supplied as a vector of the same length as dim (one log-specification for each element) or a single string that is applied for all elements. See plot.default for details.

ylim

Specifies the limits of the y-Axis. Can be either NULL (the default, limits are chosen automatically), a vector of length 2 (giving the minimum and maximum range for all elements at the same time) or a list of the same length as dim (specifying the limits for each element separately).

...

Additional arguments to plot.

Warning

The function is currently implemented only for functional data with one- and two-dimensional domains.

See Also

funData, multiFunData, plot.funData

Examples

oldpar <- par(no.readonly = TRUE)
argvals <- seq(0, 2*pi, 0.1)

# One-dimensional elements
f1 <- funData(argvals, outer(seq(0.75, 1.25, length.out = 11), sin(argvals)))
f2 <- funData(argvals, outer(seq(0.75, 1.25, length.out = 11), cos(argvals)))

m1 <- multiFunData(f1, f2)
plot(m1, main = c("1st element", "2nd element")) # different titles
plot(m1, main = "Multivariate Functional Data") # one title for all

# Mixed-dimensional elements
X <- array(0, dim = c(11, length(argvals), length(argvals)))
X[1,,] <- outer(argvals, argvals, function(x,y){sin((x-pi)^2 + (y-pi)^2)})
g <- funData(list(argvals, argvals), X)

m2 <- multiFunData(f1, g)
# different titles and labels
plot(m2, main = c("1st element", "2nd element"), obs = 1,
     xlab = c("xlab1", "xlab2"), 
     ylab = "one ylab for all")
# one title for all
plot(m2, main = "Multivariate Functional Data", obs = 1) 

## Not run: plot(m2, main = c("1st element", "2nd element")) # must specify obs!

par(oldpar)

funData documentation built on May 29, 2024, 6:08 a.m.