plot.hero_matrix {hero}R Documentation

Plot a hero object

Description

Plot the smoothed data produced by the hero function. The behavior of the function changes depending on the subclass of the hero object. See Details.

Usage

## S3 method for class 'hero_matrix'
plot(x, xlab = "", ylab = "", ...)

## S3 method for class 'hero_numeric'
plot(x, xlab = "", ylab = "", type = "l", ...)

Arguments

x

An object of class hero.

xlab

x-axis label

ylab

y-axis label

...

Additional graphical parameters passed to the relevant plotting function. See Details.

type

The plot type (when x is of subclass hero_numeric). Default is type = "l".

Details

If x has subclass hero_numeric, then the traditional plot function is used to plot the smoothed data, with type = "l".

If x has subclass hero_matrix, then image is used to plot the smoothed data, or if the autoimage package is installed, autoimage is used to plot the smoothed data.

See Also

hero

Examples

# create b-splines
x1 = bspline(nbasis = 10)
x2 = bspline(nbasis = 12)

# observed data locations
evalarg1 = seq(0, 1, len = 60)
evalarg2 = seq(0, 1, len = 80)

# construct "true" data
mu = matrix(0, nrow = 60, ncol = 80)
for(i in seq_len(60)) {
   for(j in seq_len(80)) {
      mu[i, j] =  sin(2*pi*(evalarg1[i]-.5)^3)*cos(4*pi*evalarg2[j])
   }
}
# construct noisy data
data = mu + rnorm(60 * 80)

obj = prepare(data, list(evalarg1, evalarg2), list(x1, x2))
obj = enhance(obj)
sandmod = hero(obj)
plot(sandmod)

[Package hero version 0.6 Index]