Learn R Programming

analogue (version 0.17-7)

plot.prcurve: Plot a fitted principal curve in PCA space

Description

Projects the principal curve into PCA space and draws it and the underlying data in a biplot.

Usage

# S3 method for prcurve
plot(x, axes = 1:2, scaling = 0, segments = TRUE,
     col = "red", col.seg = "forestgreen", lwd = 2,
     lwd.seg = 1, ...)

# S3 method for prcurve lines(x, axes = 1:2, scaling = 0, segments = TRUE, col = "red", col.seg = "forestgreen", lwd = 2, lwd.seg = 1, ...)

Value

A plot on the currently active device. The function does not return anything.

Arguments

x

an object of class "prcurve".

axes

numeric vector of length 2; this is passed to the choices argument of the scores function.

scaling

numeric; the scaling to use. See scores.rda for the available options. The default is not to scale the scores, but scaling = 1 might be a useful alternative.

segments

logical; should segments be drawn between the observed points to the location on the principal curve on to which they project.

col

The colour to draw the principal curve in.

col.seg

The colour to draw the segments in.

lwd, lwd.seg

The line thickness used to draw the principal curve and segments respectively.

...

additional arguments passed on to points when drawing the observations in PCA space.

Author

Gavin L. Simpson

See Also

prcurve; rda for the code used to perform the PCA.

Examples

Run this code
## Load the Abernethy Forest data
data(abernethy)

## Remove the Depth and Age variables
abernethy2 <- abernethy[, -(37:38)]

## Fit the principal curve using varying complexity of smoothers
## for each species
aber.pc <- prcurve(abernethy2, method = "ca", trace = TRUE,
                   vary = TRUE, penalty = 1.4)

## Plot the curve
plot(aber.pc)

## The lines() method can be used to add the principal curve to an
## existing plot
ord <- rda(abernethy2)
plot(ord, scaling = 1)
lines(aber.pc, scaling = 1)

Run the code above in your browser using DataLab