Plot PCA scores with ellipse using dataEllipse
1 2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | require(EEM)
data(applejuice)
applejuice_uf <- unfold(applejuice)
PCA <- prcomp(applejuice_uf)
plotScore_ellipse(PCA)
# change level
plotScore_ellipse(PCA, level = 0.8)
# manually set x,y ranges
plotScore_ellipse(PCA, xlim = c(-9000, 9000), ylim = c(-4000, 4000))
# fill in circles
plotScore_ellipse(PCA, fill = TRUE,
fill.alpha = 0.2, xlim = c(-9000, 9000), ylim = c(-4000, 4000))
# add labeling
plotScore_ellipse(PCA, labels = names(applejuice))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.