scaleDistPlot: Annotated multidimensional scaling plots.

Description Usage Arguments Value Author(s) See Also Examples

View source: R/scaleDistPlot.R

Description

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

Usage

1
2
3
4
5
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.

Author(s)

Noah Hoffman

See Also

cmdscale, xyplot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
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))

clst documentation built on Nov. 8, 2020, 5:41 p.m.