Learn R Programming

clst (version 1.20.0)

scaleDistPlot: Annotated multidimensional scaling plots.

Description

Produces annotated representations of two-dimensional multidimensional scaling plots using cmdscale.

Usage

scaleDistPlot(dmat, groups, fill, X, O, indices = "no", include, display, labels, shuffleGlyphs = NA, key = "top", keyCols = 4, glyphs, xflip = FALSE, yflip = FALSE, ...)

Arguments

dmat
Square matrix of pairwise distances.
groups
Object coercible to a factor identifying group membership of objects corresponding to either edge of dmat.
fill
vector (logical or indices) of points to fill
X
vector of points to mark with an X
O
vector of points to mark with a circle
indices
label points with indices (all points if 'yes', or a subset indicated by a vector)
include
boolean or numeric vector of elements to include in call to cmdscale
display
boolean or numeric vector of elements to include in call to display
labels
list or data frame with parameters $i indicating indices and $text containing labels.
shuffleGlyphs
modify permutation of shapes and colors given an integer to serve as a random seed.
key
'right' (single column), 'top' (variable number of columns), or NULL for no key
keyCols
number of columns in key
glyphs
a data.frame with columns named col and pch corresponding to elements of unique(groups)
xflip
if TRUE, flip orientation of x-axis
yflip
if TRUE, flip orientation of y-axis
...
additional arguments are passed to xyplot

Value

Returns a lattice grid object.

See Also

cmdscale, xyplot

Examples

Run this code
data(iris)
dmat <- as.matrix(dist(iris[,1:4], method="euclidean"))
groups <- iris$Species

## visualize pairwise euclidean dstances among items in the Iris data set
fig <- scaleDistPlot(dmat, groups)
plot(fig)

## leave-one-out analysis of the classifier
loo <- lapply(seq_along(groups), function(i){
  do.call(classify, pull(dmat, groups, i))
})
matches <- lapply(loo, function(x) rev(x)[[1]]$matches)
result <- sapply(matches, paste, collapse='-')
confusion <- sapply(matches, length) > 1
no_match <- sapply(matches, length) < 1
plot(scaleDistPlot(dmat, groups, fill=confusion, O=confusion, X=no_match))

Run the code above in your browser using DataLab