Learn R Programming

fda (version 1.2.3)

plot.fd: Plot a Functional Data Object

Description

Functional data observations, or a derivative of them, are plotted. These may be either plotted simultaneously, as matplot does for multivariate data, or one by one with a mouse click to move from one plot to another. The function also accepts the other plot specification arguments that the regular plot does.

Usage

plot.fd(x, y, Lfdobj=0, href=TRUE,
        titles=NULL, xlim=rangex, ylim=rangey,
        xlab=xlabel, ylab=ylabel, ask=FALSE, nx=201, ...)

Arguments

x
functional data object(s) to be plotted.
y
sequence of points at which to evaluate the functions 'x' and plot on the horizontal axis. Defaults to seq(rangex[1], rangex[2], length = nx).
Lfdobj
either a nonnegative integer or a linear differential operator object. If present, the derivative or the value of applying the operator is plotted rather than the functions themselves.
href
a logical variable: If TRUE, add a horizontal reference line at 0.
titles
a vector of strings for identifying curves
xlab
a label for the horizontal axis.
ylab
a label for the vertical axis.
xlim
a vector of length 2 containing axis limits for the horizontal axis.
ylim
a vector of length 2 containing axis limits for the vertical axis.
ask
a logical value: If TRUE, each curve is shown separately, and the plot advances with a mouse click
nx
the number of points to use to define the plot. The default is usually enough, but for a highly variable function more may be required.
...
additional plotting arguments that can be used with function plot

Value

  • invisible(NULL)

Side Effects

a plot of the functional observations

Details

Note that for multivariate data, a suitable array must first be defined using the par function.

See Also

lines.fd, plotfit.fd

Examples

Run this code
#daytime   <- (1:365)-0.5
#dayrange  <- c(0,365)
#dayperiod <- 365
#nbasis     <- 65
#dayrange  <- c(0,365)

daybasis65 <- create.fourier.basis(c(0, 365), 65)
harmaccelLfd <- vec2Lfd(c(0,(2*pi/365)^2,0), c(0, 365))

harmfdPar     <- fdPar(daybasis65, harmaccelLfd, lambda=1e5)

daytempfd <- with(CanadianWeather, data2fd(
        dailyAv[,,"Temperature.C"], day.5, 
        daybasis65,argnames=list("Day", "Station", "Deg C")) )

#  plot all the temperature functions for the monthly weather data
plot(daytempfd, main="Temperature Functions")

# To plot one at a time:  
# The following pauses to request page changes.
# (Without 'dontrun', the package build process
# might encounter problems with the par(ask=TRUE)
# feature.)
plot(daytempfd, main="Temperature Functions", ask=TRUE)

Run the code above in your browser using DataLab