biplot4: Draw scores as points

Description Usage Arguments Examples

Description

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

Usage

1

Arguments

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

Examples

 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)

chengvt/cheng documentation built on May 13, 2019, 3:52 p.m.