Description Usage Arguments Examples
I'm too lazy to fix the code so please always specify xcol for this to work. Biplot4 is similar to biplot3 except that the legend will be place outside
1 |
legendoutside |
(optional) set to TRUE if you want to put legend on the outside of the plot. The legend location is defaulted to topright. |
rightwhitespace |
(optional) set width for white space for legend. Only applicable if legendoutside = TRUE |
legendinset |
(optional) how much legend box will be pushed to the right. Only applicable if legendoutside = TRUE |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | require(EEM)
data(applejuice)
applejuice_uf <- unfold(applejuice) # unfold list into matrix
# get country of apple production
country <- sapply(strsplit(names(applejuice), split = "-"), "[", 1)
# select peaks
local_peak <- findLocalMax(applejuice, n = 1)
index <- colnames(applejuice_uf) %in% local_peak
applejuice_uf_selectedPeak <- applejuice_uf[,index, drop = FALSE]
# PCA
result <- prcomp(applejuice_uf_selectedPeak)
# create color palette for x points
library(RColorBrewer)
xcol <- brewer.pal(3, "Dark2")
biplot4(result, xlab = prcompname(result ,1), ylab = prcompname(result,2),
xlabs = country, xcol = xcol)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.