plot_dist_matrix: Plotting Distance Matrices (wordspace)

plot.dist.matrixR Documentation

Plotting Distance Matrices (wordspace)

Description

Visualization of a DSM distance matrix as a neighbourhood graph based on multidimensional scaling (MDS).

Usage

  ## S3 method for class 'dist.matrix'
plot(x, y, labels=rownames(x), show.labels=TRUE, label.pos=3,
     selected=attr(x, "selected"), show.selected=TRUE,
     col="black", cex=1, pch=20, pt.cex=1.2, selected.cex=1.2, selected.col="red",
     show.edges=TRUE, edges.lwd=6, edges.col="#AABBFF", edges.threshold=quantile(x, 2/3),
     method=c("isomds", "sammon"), aspect=1, expand=.05, ...)

Arguments

x

a symmetric distance matrix of class dist.matrix. NB: similarity values and asymmetric distance measures are not supported.

y

unused, must not be specified

labels

a character vector of labels for the DSM vectors (defaults to rownames of x)

show.labels

if TRUE (default), labels are displayed if available

label.pos

position of labels (default: above points). Possible values are 1 (below), 2 (left), 3 (above) and 4 (right).

selected

logical vector of selected points that will be highlighted (defaults to optional selected attribute of distance matrix)

show.selected

if TRUE (default), points marked by selected are highlighted in the plot

col

colour of points and labels

cex

numeric character expansion factor for points and labels

pch

plot symbol for points

pt.cex

character expansion factor for points relative to labels

selected.cex

additional character expansion factor for selected points and labels

selected.col

colour of selected points and labels (if show.selected=TRUE)

show.edges

if TRUE (default), edges are drawn between points. The line width of each edge is proportional to the distance between the corresponding points.

edges.lwd

maximal line width of edges (for d = 0)

edges.col

colour of edges, usually a light or translucent shade

edges.threshold

maximal distance up to which edges are drawn. The default is to display two thirds of all edges.

method

whether to perform non-metric (isomds) or metric (sammon) multidimensional scaling

aspect

aspect ratio of plot window (e.g. aspect=16/10 for a window that is 8 inches wide and 5 inches high). Setting a correct aspect ratio ensures that the distances between points in the MDS map are correctly represented in the plot.

expand

fraction by which plotting region is extended on each side. Adjust this parameter so that points and labels are completely visible.

...

all other arguments are passed to the initial plot function, which sets up the display but does not draw any graphical elements

Details

For multidimensional scaling (MDS), the functions isoMDS and sammon from the MASS package are used.

Value

Invisibly returns a two-column matrix with MDS coordinates of all displayed points and labels as rownames (if available).

Author(s)

Stephanie Evert (https://purl.org/stephanie.evert)

See Also

nearest.neighbours, which produces distance matrices suitable for plotting if the option dist.matrix=TRUE is specified

Examples

## Not run: 
plot(nearest.neighbours(DSM_Vectors, "walk_V", n=20, dist.matrix=TRUE))

## End(Not run)

wordspace documentation built on Aug. 23, 2022, 1:06 a.m.