plot.dsvord: Plotting Routines For LabDSV Ordinations

View source: R/dsvord.R

plot.dsvordR Documentation

Plotting Routines For LabDSV Ordinations

Description

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

Usage

## S3 method for class 'dsvord'
plot(x, ax = 1, ay = 2, col = 1, title = "", pch = 1,
                     xlab = paste(x$type, ax), ylab = paste(x$type, ay), ...)
## S3 method for class 'dsvord'
points(x, which, ax = 1, ay = 2, col = 2, pch = 1, cex = 1, 
                      breaks=FALSE, ...)
## S3 method for class 'dsvord'
plotid(ord, ids = seq(1:nrow(ord$points)), ax = 1, ay = 2,
       col = 1, ...)
## S3 method for class 'dsvord'
hilight(ord, overlay, ax = 1, ay = 2, title="", 
        cols=c(2,3,4,5,6,7), glyph=c(1,3,5), ...)
## S3 method for class 'dsvord'
chullord(ord, overlay, ax = 1, ay = 2, cols=c(2,3,4,5,6,7), 
        ltys = c(1,2,3), ...)
## S3 method for class 'dsvord'
ellip(ord, overlay, ax = 1, ay = 2, cols=c(2,3,4,5,6,7),
        ltys = c(1,2,3), ...)
## S3 method for class 'dsvord'
surf(ord, var, ax = 1, ay = 2, thinplate = TRUE, col = 2, 
        labcex = 0.8, lty = 1, family = gaussian, gamma=1, grid=50, ...)
## S3 method for class 'dsvord'
thull(ord,var,grain,ax=1,ay=2,col=2,grid=51,nlevels=5,
        levels=NULL,lty=1,
     numitr=100,...)
## S3 method for class 'dsvord'
density(ord, overlay, ax = 1, ay = 2, cols = c(2, 3, 4, 5,
    6, 7), ltys = c(1, 2, 3), numitr, ...)

Arguments

x

an object of class ‘dsvord’

ax

the dimension to use for the X axis

ay

the dimension to use for the Y axis

title

a title for the plot

xlab

label for X axis

ylab

label for Y axis

which

a logical variable to specify points to be highlighted

breaks

a logical switch to control using variable glyph sizes in ‘points’

ord

an object of class ‘dsvord’

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

lty

the line type to be used

ltys

the sequence of line types to be used

var

a variable to be surfaced or tension hulled

thinplate

a logical variable to control the fitting routine: thinplate=TRUE (the default) fits a thinplate spline, thinplate=FALSE fits independent smooth splines. If you have too few data points you may have to specify thinplate=FALSE

family

controls the link function passed to ‘gam’: one of ‘gaussian’, ‘binomial’, ‘poisson’ or ‘nb’

gamma

controls the smoothness of the fit from gam

grid

the number of X and Y values to use in establishing a grid for use in surf

grain

the size of cell to use in calculating the tensioned hull

nlevels

the number of contours to draw in representing the tensioned hull

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

numitr

the number of iterations to use in estimating the probability of the observed density

levels

specific levels for contours in thull

...

arguments to pass to the plot function

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’, and ‘surf’ 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 ordination, 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.

Function ‘ellip’ is passed a factor vector or integer vector, and plots minimal volume ellipses containingg all points within a class. By specifying values for arguments ‘cols’ and ‘ltys’ it is possible to control the sequence of colors and linetypes of the ellipses.

Function ‘density’ calculates the fraction of points within the convex hull that belong to the specified type.

Function ‘surf’ calculates and plots fitted surfaces for logical or quantitative variables. The function employs the gam function to fit a variable to the ordination coordinates, and to predict the values at all grid points. The grid is established with the ‘expand.grid’ function, and the grid is then specified in a call to ‘predict.gam’. The predicted values are trimmed to the the convex hull of the data, and the contours are fit by ‘contour’. 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 or ‘family='nb'’ to get a negative binomial fit.

Function ‘thull’ calculates a tensioned hull for a specific variable on the ordination. A tensioned hull is a minimum volume container. The grain size must be specified as a fraction of the units of the NMDS, with larger values generating smoother representations, and smaller numbers a more resolved container. ‘thull’ returns an invisible object of class ‘thull’ which has an associated plot function. Plotting the thull object produces a colored surface representation of the thull with optional contour lines.

Value

Function ‘plotid’ returns a vector of row numbers of identified plots

Note

The contouring routine using predict.gam follows ordisurf as suggested by Jari Oksanen.

Author(s)

David W. Roberts droberts@montana.edu

Examples

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)
## Not run: plotid(nmds.1,ids=row.names(bryceveg))

labdsv documentation built on April 10, 2023, 5:08 p.m.

Related to plot.dsvord in labdsv...