| plot.tclust {tclust} | R Documentation |
Plot Method for tclust and tkmeans Objects
Description
One and two dimensional structures are treated separately (e.g. tolerance
intervals/ellipses are displayed). Higher dimensional structures are displayed
by plotting the two first Fisher's canonical coordinates (evaluated by
tclust::discr_coords) and derived from the final cluster assignments
(trimmed observations are not taken into account).
plot.tclust.Nd can be called with one or two-dimensional tclust- or tkmeans-objects
too. The function fails, if store.x = FALSE is specified in the tclust() or tkmeans() call,
because the original data matrix is required here.
Usage
## S3 method for class 'tclust'
plot(x, ...)
## S3 method for class 'tkmeans'
plot(x, ...)
Arguments
x |
The |
... |
Further (optional) arguments which specify the details of the resulting plot (see section "Further Arguments"). |
Details
The plot method for classes tclust and tkmeans.
Further Arguments
-
xlab, ylab, xlim, ylim, pch, colArguments passed toplot(). -
mainThe title of the plot. Use"/p"for displaying the chosen parametersalphaandkor"/r"for plotting the chosen restriction. -
main.preAn optional string which is added to the plot's caption. -
subA string specifying the subtitle of the plot. Use"/p"(default) for displaying the chosen parametersalphaandk,"/r"for plotting the chosen restriction and"/pr"for both. -
sub1A secondary (optional) subtitle. -
labelsA string specifying the type of labels to be drawn. Eitherlabels="none"(default),labels="cluster"orlabels="observation"can be specified. If specified, parameterpchis ignored. -
textA vector of length n (the number of observations) containing strings which are used as labels for each observation. If specified, the parameterslabelsandpchare ignored. -
by.clusterLogical value indicating whether parameterspchandcolrefer to observations (FALSE) or clusters (TRUE). -
jitter.yLogical value, specifying whether the drawn values shall be jittered in y-direction for better visibility of structures in 1 dimensional data. -
tolThe tolerance interval. 95% tolerance ellipsoids (assuming normality) are plotted by default. -
tol.col, tol.lty, tol.lwdVectors of length k or 1 containing thecol,ltyandlwdarguments for the tolerance ellipses/lines.
Examples
#--- EXAMPLE 1------------------------------
sig <- diag (2)
cen <- rep (1, 2)
x <- rbind(MASS::mvrnorm(360, cen * 0, sig),
MASS::mvrnorm(540, cen * 5, sig * 6 - 2),
MASS::mvrnorm(100, cen * 2.5, sig * 50))
# Two groups and 10\% trimming level
a <- tclust(x, k = 2, alpha = 0.1, restr.fact = 12)
plot (a)
plot (a, labels = "observation")
plot (a, labels = "cluster")
plot (a, by.cluster = TRUE)
#--- EXAMPLE 2------------------------------
sig <- diag (2)
cen <- rep (1, 2)
x <- rbind(MASS::mvrnorm(360, cen * 0, sig),
MASS::mvrnorm(540, cen * 5, sig),
MASS::mvrnorm(100, cen * 2.5, sig))
# Two groups and 10\% trimming level
a <- tkmeans(x, k = 2, alpha = 0.1)
plot (a)
plot (a, labels = "observation")
plot (a, labels = "cluster")
plot (a, by.cluster = TRUE)