Learn R Programming

labdsv (version 1.2-0)

plot.nmds: Plotting Routines For Nonmetric Multi-dimensional Scaling Ordinations

Description

A set of routines for plotting, highlighting points, or adding fitted surfaces to NMDSs.

Usage

## S3 method for class 'nmds':
plot(x, ax = 1, ay = 2, col = 1, title = "", pch = 1, \dots)
## S3 method for class 'nmds':
points(x, which, ax = 1, ay = 2, col = 2, pch = 1, cex = 1, \dots)
## S3 method for class 'nmds':
plotid(ord, ids = seq(1:nrow(ord$points)), ax = 1, ay = 2, 
    col = 1, ...)
## S3 method for class 'nmds':
hilight(ord, overlay, ax = 1, ay = 2, cols=c(2,3,4,5,6,7), glyph=c(1,3,5), 
    origpch = 1, blank = '#FFFFFF', ...)
## S3 method for class 'nmds':
chullord(ord, overlay, ax = 1, ay = 2, cols=c(2,3,4,5,6,7), ltys = c(1,2,3), ...)
## S3 method for class 'nmds':
surf(ord, var, ax = 1, ay = 2, col = 2, labcex = 0.8, 
    family = gaussian, \dots)
## S3 method for class 'nmds':
jsurf(ord, var, ax = 1, ay = 2, col = 2, labcex = 0.8, 
    family = gaussian, \dots)

Arguments

x
an object of class nmds
ax
the dimension to use for the X axis
ay
the dimension to use for the Y axis
title
a title for the plot
which
a logical variable to specify points to be highlighted
ord
an object of class nmds
overlay
a factor or integer vector to hilight or distinguish
cols
the sequence of color indices to be used
glyph
the sequence of glyphs (pch) to be used
origpch
the pch number of the glyph employed in the original plot (to be obliterated by blank)
blank
the color to use to erase the glyphs of the original plot
ltys
the sequence of line types to be used
var
a variable to be surfaced
family
controls the link function passed to gam: one of gaussian, binomial, or poisson
ids
identifier labels for samples. Defaults to 1:n
col
color index for points or contours
labcex
size of contour interval labels
pch
plot character: glyph to plot
cex
character expansion factor: size of plotted characters
...
arguments to pass to the plot function

Value

  • Function plotid returns a vector of row numbers of identified plots

Details

Function plot produces a scatter plot of sample scores for the specified axes, erasing or over-plotting on the current graphic device. Axes dimensions are controlled to produce a graph with the correct aspect ratio. Functions points, plotid, surf, and jsurf add detail to an existing plot. The axes specified must match the underlying plot exactly.

Function plotid identifies and labels samples (optionally with values from a third vector) in the NMDS, and requires interaction with the mouse: left button identifies, right button exits.

Function points is passed a logical vector to identify a set of samples by color of glyph. It can be used to identify a single set meeting almost any criterion that can be stated as a logical expression.

Function hilight is passed a factor vector or integer vector, and identifies factor values by color and glyph.

Function chullord is passed a factor vector or integer vector, and plots a convex hull around all points in each factor class. By specifying values for arguments cols and ltys it is possible to control the sequence of colors and linetypes of the convex hulls.

Functions surf and jsurf calculate and plot fitted surfaces for logical or quantitative variables; jsurf jitters the coordinates to avoid problems with identical values in fitting the surface. The functions are simply wrappers for the gam function, and send the sample coordinates and the var variable to gam to model. The coordinates and the fitted values from gam are then passed to interp, which plots the contours. The default link function for fitting the GAMs is gaussian, suitable for unbounded continuous variables. For logical variables you should specify family = binomial to get a logistic GAM, and for integer counts you should specify family = poisson to get a Poisson GAM.

References

http://ecology..msu.montana.edu/labdsv/R

Examples

Run this code
data(bryceveg)
data(brycesite)
dis.bc <- dsvdis(bryceveg,'bray/curtis')
nmds.1 <- nmds(dis.bc,5)
plot(nmds.1)
points(nmds.1,brycesite$elev>8000)
surf(nmds.1,brycesite$elev)
plotid(nmds.1,ids=row.names(bryceveg))

Run the code above in your browser using DataLab