Attachment 'dudi-pca-plot-01.R'
Download 1 f.PCA.Dudi.plot <- function (dudi.pca, title.ch,
2 cp.nv = c (2, 3), sf.n = 0.1, dot.col = "grey")
3
4 {
5
6 c1 <- cp.nv[1]
7 c2 <- cp.nv[2]
8
9 x.delta <- abs (min (dudi.pca$co[, c1]) - max (dudi.pca$co[, c1]))
10 y.delta <- abs (min (dudi.pca$co[, c2]) - max (dudi.pca$co[, c2]))
11 x.lim <- c (min (dudi.pca$co[, c1]) - sf.n * x.delta, max (dudi.pca$co[, c1]) + sf.n * x.delta)
12 y.lim <- c (min (dudi.pca$co[, c2]) - sf.n * y.delta, max (dudi.pca$co[, c2]) + sf.n * y.delta)
13
14 x11()
15 plot (x = dudi.pca$co[, c1],
16 y = dudi.pca$co[, c2],
17 xlab = paste ("PC", c1),
18 ylab = paste ("PC", c2),
19 xlim = x.lim,
20 ylim = y.lim,
21 main = paste (title.ch , "- PCA biplot"),
22 pch = 19, lwd = 3, col = dot.col)
23
24 text (labels = rownames (dudi.pca$co),
25 x = dudi.pca$co[, c1],
26 y = dudi.pca$co[, c2])
27
28 x11()
29 barplot (height = dudi.pca$eig[c1:length (dudi.pca$eig)],
30 col = "aquamarine4", border = "aquamarine4" , space = 0,
31 xlab = paste (title.ch, "- PCA eigenvalues from", c1))
32
33 return()
34
35 }
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.