plot.functional {ddalpha} | R Documentation |
Plot functions for the Functional Data
Description
Plots the functional data given in the form which is described in the topic dataf.*
.
Usage
## S3 method for class 'functional'
plot(x,
main = "Functional data", xlab = "args", ylab = "vals",
colors = c("red", "blue", "green", "black", "orange", "pink"), ...)
## S3 method for class 'functional'
lines(x,
colors = c("red", "blue", "green", "black", "orange", "pink"), ...)
## S3 method for class 'functional'
points(x,
colors = c("red", "blue", "green", "black", "orange", "pink"), ...)
Arguments
x |
The functional data as in the topic |
main |
an overall title for the plot: see |
xlab |
a title for the x axis: see |
ylab |
a title for the y axis: see |
colors |
the colors for the classes of the data. The colors are applied to the classes sorted in alphabetical order. Use the same set of classes to ensure that the same colours are selected in |
... |
additional parameters |
See Also
dataf.*
for functional data description
Examples
## Not run:
## load the Growth dataset
dataf = dataf.growth()
labels = unlist(dataf$labels)
plot(dataf,
main = paste("Growth: girls red (", sum(labels == "girl"), "),",
" boys blue (", sum(labels == "boy"), ")", sep=""),
xlab="Year", ylab="Height, cm",
colors = c("blue", "red") # in alphabetical order of class labels
)
# plot an observation as a line
observation = structure(list(dataf = list(dataf$dataf[[1]])), class = "functional")
lines(observation, colors = "green", lwd = 3)
# plot hight at the age of 14
indexAge14 = which(observation$dataf[[1]]$args == 14)
hightAge14 = observation$dataf[[1]]$vals[indexAge14]
atAge14 = structure(list(
dataf = list(dataf = list(args = 14, vals = hightAge14))
), class = "functional")
points(atAge14, colors = "yellow", pch = 18)
## End(Not run)
[Package ddalpha version 1.3.15 Index]