Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot.fdata

Plot functional data: fdata class object


Description

Plot object of class fdata.

Usage

## S3 method for class 'fdata'
plot(x, type, main, xlab, ylab, lty = 1, mfrow = c(1, 1), time = 1, ...)

## S3 method for class 'fdata'
lines(x, ...)

title.fdata(x, main = NULL, xlab = NULL, ylab = NULL, rownames = NULL)

## S3 method for class 'mdepth'
plot(x, trim, levgray = 0.9, ...)

## S3 method for class 'depth'
plot(x, trim, levgray = 0.9, ...)

## S3 method for class 'bifd'
plot(x, argvals.s, argvals.t, ...)

Arguments

x

fdata class object with:

  • "data": For fdata class object as curve (1d), "data" is a matrix (by default), data.frame or array of set cases with dimension (n x m), where n is the number of curves and m are the points observed in each curve over the x–axe.
    For fdata2d class object as surface (2d). "data" is a array of set cases with dimension (n x m1 x m2), where n is the number of functional data and m1 and m2 are the points observed over the x–y plane.

  • "argvals": vector or list of vectors with the discretizations points values.

  • "rangeval": vector or list of vectors with the range of the discretizations points values, by default range(argvals).

  • "names": (optional) list with main an overall title, xlab title for x axis and ylab title for y axis.

or a two-argument functional data object, see bifd.

type

1-character string giving the type of plot desired.
The following values are possible for fdata class object: "l" for lines (by default),"p" for points, , "o" for overplotted points and lines, "b", "c" for (empty if "c") points joined by lines, "s" and "S" for stair steps and "h" for histogram-like vertical lines. Finally, "n" does not produce any points or lines.
The following values are possible for fdata2d class object: "image.contour" (by default) to display three-dimensional data and add the contour lines, "image" to display three-dimensional data, "contour" to display a contour plot, "persp" to display a perspective plots of a surface over the x-y plane and "filled.contour" to display a contour plot with the areas between the contours filled in solid color.

main

an overall title for the plot: see title.

xlab

xlab title for x axis, as in plot.

ylab

ylab title for y axis, as in plot.

lty

a vector of line types, see par.

mfrow

A vector of the form c(nr, nc). Subsequent figures will be drawn in an nr-by-nc array on the device by rows (mfrow).

time

The time interval to suspend plot execution for, in seconds, see Sys.sleep.

...

Further arguments passed to matplot function (for fdata class) or image, contour, persp or filled.contour (for fdata2d class).

rownames

Row names.

trim

The alpha of the trimming.

levgray

A vector of desired gray levels between 0 and 1; zero indicates "black" and one indicates "white".

argvals.s

a vector of argument values for the first argument s of the functional data object to be evaluated.

argvals.t

a vector of argument values for the second argument t of the functional data object to be evaluated.

Author(s)

Manuel Febrero Bande and Manuel Oviedo de la Fuente <manuel.oviedo@usc.es>

See Also

See Also as fdata

Examples

## Not run: 
# Example for fdata class of 1 dimension (curve)
a1<-seq(0,1,by=.01)
a2=rnorm(length(a1),sd=0.2)
f1<-(sin(2*pi*a1))+rnorm(length(a1),sd=0.2)
nc<-10
np<-length(f1)
tt=seq(0,1,len=101)
mdata<-matrix(NA,ncol=np,nrow=nc)
for (i in 1:nc) mdata[i,]<- (sin(2*pi*a1))+rnorm(length(a1),sd=0.2)
fdataobj<-fdata(mdata,tt)
res=plot.fdata(fdataobj,type="l",col=gray(1:nrow(mdata)/nrow(mdata)))
lines(func.mean(fdataobj),col=3,lwd=2) #original curve

# example for fdata2d class of 2 dimension (surface)
t1 <- seq(0, 1, length= 51)
t2 <- seq(0, 1, length= 31)
z<-array(NA,dim=c(4,51,31))
for (i in 1:4) z[i,,] <- outer(t1, t2, function(a, b) (i*a)*(b)^i)
z.fdata<-fdata(z,list(t1,t2))
plot(z.fdata,time=2)
plot(z.fdata,mfrow=c(2,2),type="persp",theta=30)

## End(Not run)

fda.usc

Functional Data Analysis and Utilities for Statistical Computing

v2.0.2
GPL-2
Authors
Manuel Febrero Bande [aut], Manuel Oviedo de la Fuente [aut, cre], Pedro Galeano [ctb], Alicia Nieto [ctb], Eduardo Garcia-Portugues [ctb]
Initial release
2020-02-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.