Learn R Programming

tclust (version 1.0-2)

plot.tclust: Plot Method for tclust Objects

Description

Plots a tclust object created by tclust.

Usage

plot.tclust(x, ...)
plot.tclust.1d(x, tol = 0.95, jitter.y = FALSE, col, main, sub, labels = c("cluster", "observation"), text, xlab, ylab = "", ...)
plot.tclust.2d(x, tol = 0.95, col, labels = c("cluster", "observation"), main, sub, tol.col = 1, tol.lty = 3, text, xlab, ylab, ...)
plot.tclust.Nd(x, col, labels = c("cluster", "observation"), main, sub, text, xlab, ylab, ...)

Arguments

x
The tclust object to be printed.
col
A color vector of length 1 or n (the number of observations).
tol
The tolerance interval . 95% tolerance ellipsoids (assuming normality) are plotted by default.
labels
A string specifying the type of labels to be drawn. Either "cluster" or "observation" can be specified. If specified, parameter pch is ignored. If omitted, the symbol, specified by pch is used.
text
A vector of length n (the number of observations) containing strings which are used as labels for each observation. If specified, the parameters text and pch are ignored.
jitter.y
Logical value, specifying whether the drawn values shall be jittered in y-direction for better visibility of structures in 1 dimensional data .
tol.col
A vector of length k or 1 containing the color of the tolerance ellipsis/lines.
tol.lty
A vector of length k or 1 containing the line type of the tolerance ellipsis/lines.
xlab, ylab, sub, main
Arguments passed to plot.
...
Parameters passed to plot-function.

Value

  • No return value is provided.

encoding

latin1

Details

plot.tclust selects the appropriate function according to the dimensionality of the tclust object. 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 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-objects too. The function fails, if "store.x = FALSE" is specified in tclust, because the original data matrix is required here.

Examples

Run this code
#--- EXAMPLE 1------------------------------
sig <- diag (2)
cen <- rep (1,2)
x <- rbind (
	rmvnorm (360, cen * 0,   sig),
	rmvnorm (540, cen * 5,   sig * 6 - 2),
	rmvnorm (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")

#--- EXAMPLE 2------------------------------
x <- c(	rnorm(72,	0,   1),
		rnorm(108, 10,   1),
		rnorm(20,  2.5, 10))a <- tkmeans (x, k = 2, alpha = 0.1)
plot (a, jitter.y = TRUE)

Run the code above in your browser using DataLab