Learn R Programming

Momocs (version 1.4.1)

PCcontrib: Shape variation along PC axes

Description

Calculates and plots shape variation along Principal Component axes.

Usage

PCcontrib(PCA, ...)

# S3 method for PCA PCcontrib(PCA, nax, sd.r = c(-2, -1, -0.5, 0, 0.5, 1, 2), gap = 1, ...)

Value

(invisibly) a list with gg the ggplot object and shp the list of shapes.

Arguments

PCA

a PCA object

...

additional parameter to pass to coo_draw

nax

the range of PCs to plot (1 to 99pc total variance by default)

sd.r

a single or a range of mean +/- sd values (eg: c(-1, 0, 1))

gap

for combined-Coe, an adjustment variable for gap between shapes. (bug)Default to 1 (whish should never superimpose shapes), reduce it to get a more compact plot.

Examples

Run this code
bot.p <- PCA(efourier(bot, 12))
PCcontrib(bot.p, nax=1:3)
# \donttest{
library(ggplot2)
gg <- PCcontrib(bot.p, nax=1:8, sd.r=c(-5, -3, -2, -1, -0.5, 0, 0.5, 1, 2, 3, 5))
gg$gg + geom_polygon(fill="slategrey", col="black") + ggtitle("A nice title")
# }

Run the code above in your browser using DataLab