Learn R Programming

vows (version 0.5)

plot.funkmeans: Plotting of k-means clustering results for massively parallel smooths

Description

Visualization of functional k-means clustering as implemented by funkmeans.

Usage

"plot"(x, fdobj = NULL, deriv = 0, ncluster = nrow(x$centers), new.array = TRUE, mfrow = NULL, colvec = NULL, cex.mtext = 0.7, xlabs = "", ylabs = "", titles = "", ...)

Arguments

x
a functional k-means clustering object obtained from funkmeans.
fdobj
a functional data object, of class "fd", defining the set of curves being clustered. By default, this is taken to be x$fdobj; but if the latter is NULL, fdobj must be specified. See the two cases in the example.
deriv
which derivative to display in the plots, which show 30 randomly selected curves, along with the cluster center, from each cluster. By default, the "0th derivative" is used (i.e., the curves themselves).
ncluster
number of clusters to display. By default, all are displayed.
new.array
logical: if TRUE, plots will be displayed in an array whose dimensions are set by the mfrow argument.
mfrow
a vector of length 2 giving the numbers of rows and columns for the array of plots. By default, the number of rows will exceed the number of columns by 0 or 1, depending on ncluster.
colvec
a vector of colors for the clusters. By default, this is set to the first ncluster elements of c("dodgerblue", "green", "red", "orange", "yellow", "orchid", "brown", "grey", "purple"), if ncluster <= 9<="" code="">.
cex.mtext
magnification for mtext command to display the size of each cluster above the corresponding subfigure.
xlabs, ylabs, titles
?????NULL or a character vector of length 1 or ncluster, specifying titles (x axis, y axis, overall titles) for each cluster. If vector's length equals 1, each cluster plot has the same title. By default, it's NULL
...
arguments passed to plot.

See Also

funkmeans

Examples

Run this code

data(test)
d4 = test$d4
x = test$x
semi.obj = semipar4d(d4, formula = ~sf(x), data = data.frame(x = x), lsp=-5:5)
myfdobj = extract.fd(semi.obj)

# Case 1: fd object is stored in funkmeans object...
fkmobj = funkmeans(myfdobj, ncomp = 8, centers = 6)
plot(fkmobj)

# Case 2: fd object is not stored...
fkmobj = funkmeans(myfdobj, ncomp = 8, centers = 6, store.fdobj=FALSE)
plot(fkmobj, myfdobj)

Run the code above in your browser using DataLab