Set up
1) Load packages
# ---------------------------------------
# Visualize PCA (Biplot) using ggbiplot()
# ---------------------------------------
# clear data and values in golbal environment and close windows or plots
# shell("cls") = Clear console
rm(list = ls(all = TRUE))
graphics.off()
shell("cls")
library(readxl)
library(dplyr)
library(tidyr)
library(tidyverse)
library(janitor)
# ------
# Installing ggbiplot package
# ------
library(devtools)
install_github("vqv/ggbiplot")
#------
# Plotting PCA using ggbiplot()
#------
require(ggbiplot)
2) Import data
soilhealthpca <- read_excel("7-12-21 part 1 NRCS pca.xlsx")
#change column names
data <- soilhealthpca %>%
clean_names() %>% na.omit()
#names(data)
#colnames(data)[1] <- "sample_pca"
#colnames(data)[2] <- "location"
#colnames(data)[3] <- "treatment"
colnames(data)[4] <- "Clay"
colnames(data)[5] <- "TN"
colnames(data)[6] <- "SOC"
colnames(data)[7] <- "Ca"
colnames(data)[8] <- "Cu"
colnames(data)[9] <- "Mg"
colnames(data)[10] <- "Mn"
colnames(data)[11] <- "Na"
colnames(data)[12] <- "P"
colnames(data)[13] <- "pH"
colnames(data)[14] <- "K"
colnames(data)[15] <- "Zn"
colnames(data)[16] <- "Fe"
colnames(data)[17] <- "CEC"
colnames(data)[18] <- "GWC"
colnames(data)[19] <- "BD"
colnames(data)[20] <- "POXC"
colnames(data)[21] <- "MWD"
colnames(data)[22] <- "Resp"
colnames(data)[23] <- "MB"
colnames(data)[24] <- "GmP"
colnames(data)[25] <- "GmN"
colnames(data)[26] <- "Act"
colnames(data)[27] <- "AMF"
colnames(data)[28] <- "Fun"
colnames(data)[29] <- "FB"
colnames(data)[30] <- "bG"
colnames(data)[31] <- "NAG"
colnames(data)[32] <- "AP"
colnames(data)[33] <- "ALK"
colnames(data)[34] <- "ARY"
colnames(data)[35] <- "PHO"
colnames(data)[36] <- "Pro"
#names(data)
3) Theme James
library(grid)
library(ggthemes)
pd <- position_dodge(0.1)
theme_James <- function(base_size=14, base_family="TT Times New Roman") {
(theme_foundation(base_size=base_size, base_family=base_family)+
theme_bw()+
theme(panel.background = element_rect(colour = NA),
plot.background = element_rect(colour = NA),
axis.title = element_text(color="black",size=rel(1.2)),
axis.text = element_text(color="black", size = 12),
legend.key = element_rect(colour = NA),
legend.spacing = unit(0, "cm"),
legend.text = element_text(size=12),
legend.title = element_blank(),
panel.grid = element_blank(),
plot.title = element_text(color="Black",size = rel(1.5),face = "bold",hjust = 0.5),
strip.text = element_text(color="Black",size = rel(1),face="bold")
))
}
Overall PCA
#------
# Principal component analysis
#------
require(stats)
pc <- prcomp(x = data[, -(1:3)], # Give response variable range
center = TRUE,
scale. = TRUE)
print(pc)
## Standard deviations (1, .., p=33):
## [1] 3.748679e+00 2.223874e+00 1.632756e+00 1.319873e+00 1.139146e+00
## [6] 1.119728e+00 1.025866e+00 9.654615e-01 8.527696e-01 8.384671e-01
## [11] 7.733103e-01 6.598787e-01 6.386146e-01 5.846609e-01 5.493262e-01
## [16] 5.048305e-01 4.666459e-01 4.469059e-01 3.820419e-01 3.743381e-01
## [21] 3.125559e-01 2.751891e-01 2.702882e-01 2.614230e-01 2.305730e-01
## [26] 2.239487e-01 2.105593e-01 1.854197e-01 1.784957e-01 1.681426e-01
## [31] 1.484083e-01 7.304612e-02 1.664748e-15
##
## Rotation (n x k) = (33 x 33):
## PC1 PC2 PC3 PC4 PC5
## Clay 0.108058573 -0.273221846 0.005428374 -0.152537647 0.111331199
## TN -0.248821995 0.009456019 -0.053087970 -0.000131103 0.074729284
## SOC -0.242284877 -0.037136420 -0.086643251 0.004775579 0.051864166
## Ca 0.128875985 -0.309297607 -0.213100535 0.086532823 0.164481211
## Cu -0.045774076 -0.126736258 0.312313193 -0.385915264 0.203970810
## Mg 0.098456907 -0.174669838 0.243924873 -0.140729496 -0.427182379
## Mn -0.176461809 0.226381630 -0.022810425 -0.270637039 0.065554908
## Na 0.040949079 -0.196764063 0.125886514 -0.436301635 -0.341606947
## P -0.035069824 0.309004579 -0.285399415 -0.290221266 0.009839775
## pH 0.151042858 -0.269947947 -0.278694564 0.133444552 -0.120654422
## K -0.052070496 0.285440317 -0.340407773 -0.120847891 -0.144933558
## Zn -0.219953444 0.005798106 -0.080526424 -0.081818016 -0.012316072
## Fe -0.152236710 0.121852772 0.366232449 -0.096585189 0.151001425
## CEC 0.142091934 -0.326102862 -0.150247849 -0.017148557 -0.002478381
## GWC -0.048824265 -0.224981750 0.091257673 -0.217070774 0.174867128
## BD 0.091747245 -0.078593404 0.118898959 -0.052002905 0.527802991
## POXC -0.001819254 0.128394485 0.383970070 0.429112601 0.032645781
## MWD -0.163403599 -0.154115181 0.037282641 -0.108446320 -0.156694176
## Resp -0.217971627 -0.110838537 0.022246053 0.076230747 0.039567538
## MB -0.232530890 -0.153581253 0.003550388 0.046623466 -0.073844101
## GmP -0.225403849 -0.146007314 0.030816366 0.006463688 -0.090291064
## GmN -0.166826745 -0.068096330 0.085003328 0.150050656 -0.058909148
## Act -0.167334875 -0.090772262 0.115422253 0.107100082 0.063222440
## AMF -0.226799257 -0.178239714 -0.016155062 0.012188881 0.086183088
## Fun -0.177764261 -0.147591107 0.005139120 -0.008975414 -0.227049664
## FB -0.083743794 -0.093891802 -0.247208566 -0.222570799 0.298985230
## bG -0.220123868 0.079966086 -0.053468667 0.068763736 0.054663451
## NAG -0.250216262 0.025446803 0.043458127 -0.037763068 -0.063601734
## AP -0.244405809 0.032253435 -0.010906364 0.083129113 -0.090727136
## ALK -0.182531996 -0.142277534 -0.258955109 0.164664044 0.012326900
## ARY -0.224249508 -0.138581834 -0.008963336 0.088561053 -0.080496184
## PHO -0.218533879 -0.164206218 -0.076999116 0.062083085 0.141779931
## Pro -0.223734379 0.129087344 -0.003849623 -0.120613501 -0.028199910
## PC6 PC7 PC8 PC9 PC10
## Clay -0.102994025 0.158746320 -0.251353789 0.3127470030 -2.237300e-01
## TN -0.169674168 0.047166168 0.043932584 0.1488709927 -1.137160e-02
## SOC -0.109017879 0.089692823 0.121806439 0.0529525910 5.133094e-02
## Ca -0.066384856 -0.076062928 0.146754883 0.1381346217 1.341345e-02
## Cu -0.108571728 -0.107265870 -0.016445171 0.1892051214 9.368573e-03
## Mg -0.213652382 -0.194181069 0.142440212 -0.3474870094 7.907649e-03
## Mn -0.004825207 -0.082704193 -0.046961498 0.1641379567 -1.667136e-01
## Na -0.096759247 -0.168331173 -0.022229755 0.1666368111 1.793063e-02
## P 0.130430953 -0.007699170 0.233526854 0.0520209033 -5.332517e-02
## pH -0.070061260 -0.019188064 0.106601439 -0.0112278980 1.431693e-03
## K -0.022484461 -0.177196207 0.081452384 -0.1660792596 -2.476802e-01
## Zn -0.318674991 -0.069943355 0.234826737 0.0915494460 4.371361e-05
## Fe 0.094243183 0.215995504 0.009944151 0.0633902966 2.096293e-01
## CEC -0.124441411 -0.150003720 0.171535990 0.0532932295 -3.370314e-03
## GWC 0.086056651 0.350484526 0.532785188 -0.3557655665 8.811406e-02
## BD -0.003855021 -0.253182361 0.033310776 -0.2724466846 -5.883331e-01
## POXC -0.283958600 -0.122295130 0.039980558 -0.1016456948 -1.623426e-02
## MWD -0.115135608 0.257989396 -0.410479562 -0.1008700511 -2.717446e-01
## Resp -0.224974829 -0.217428689 0.106910308 0.1781422115 6.959595e-02
## MB 0.245072607 -0.081910102 0.080179062 0.0354617543 -4.305868e-02
## GmP 0.250323374 -0.081474873 -0.007057506 0.0419793196 -4.185175e-02
## GmN 0.307691647 0.041996219 0.243050697 0.3511204987 -1.212465e-01
## Act 0.262406436 -0.452650248 -0.080978248 -0.0800955518 7.061139e-03
## AMF 0.119805378 -0.147097019 0.036306112 -0.0255107286 1.579435e-01
## Fun 0.386026952 -0.099682133 -0.095147091 -0.1291200589 -1.498114e-01
## FB 0.016421852 -0.164466546 -0.368386260 -0.2993424074 4.990470e-01
## bG -0.193603253 -0.244749873 0.026342910 0.0527150441 1.255926e-01
## NAG -0.101652859 -0.001588709 -0.009299107 -0.1222041263 -4.601656e-02
## AP -0.199799623 -0.015809142 -0.083450612 0.0002706274 -9.844918e-03
## ALK -0.130348969 0.111698283 -0.095678578 -0.0351743574 -1.557624e-01
## ARY -0.016943605 0.253580945 -0.075868670 -0.2427426889 -4.001455e-02
## PHO -0.059701024 0.185794749 -0.028784012 -0.0013458477 -3.039267e-02
## Pro -0.136925867 0.051692282 0.099468755 -0.1751271408 -1.347884e-01
## PC11 PC12 PC13 PC14 PC15
## Clay 0.250402134 0.204930601 -0.40527184 -0.276891843 0.35539571
## TN 0.051630710 -0.001922577 -0.01883222 0.026128080 -0.04280210
## SOC 0.167949873 -0.085863635 -0.25611425 0.110306759 -0.08237915
## Ca -0.098678022 -0.126878412 -0.09498413 0.355166983 0.05559780
## Cu -0.529112855 -0.331823334 0.16047329 -0.127714258 0.23909956
## Mg 0.112116249 -0.233657281 -0.08600040 -0.173541128 0.03572456
## Mn -0.137111637 0.077086939 0.02566673 -0.113975328 -0.16517272
## Na 0.277356523 0.396702342 0.36133014 0.153297121 -0.14058025
## P -0.014390039 -0.073925049 0.06412970 0.213564998 0.02174465
## pH -0.044631091 -0.048017999 0.02996904 -0.010625622 -0.12184533
## K -0.088702074 -0.092481154 -0.13972073 -0.252576796 0.06450875
## Zn 0.092860056 -0.100317819 -0.16852343 0.045563389 0.09987104
## Fe 0.205088772 -0.083661540 -0.22129510 0.248246516 -0.01433337
## CEC -0.037085454 -0.128935594 -0.07345777 0.284357349 0.04702058
## GWC -0.087192678 0.242252152 0.05270819 -0.174753436 0.05540476
## BD 0.292365907 -0.035821182 0.07864803 0.016781956 -0.23474269
## POXC -0.011216093 -0.059938028 0.13295664 0.018477732 0.13233406
## MWD -0.133716990 -0.269498103 0.07109959 0.329914746 -0.23287231
## Resp -0.044805707 -0.018738469 -0.16786171 -0.284291466 -0.30242053
## MB -0.004131372 -0.051165732 -0.05971395 -0.068843940 -0.06005631
## GmP -0.162384673 0.020860695 -0.09826156 -0.038849600 -0.23240566
## GmN 0.376200663 -0.346251014 0.36896466 -0.127163760 0.08667108
## Act -0.185430662 0.393492370 -0.12646888 0.222019045 0.18546177
## AMF -0.013824870 -0.002253462 -0.02160489 -0.002616765 -0.22596068
## Fun 0.050008151 -0.182173200 -0.13520829 -0.014555192 0.34954634
## FB 0.285704930 -0.232723464 0.12564350 -0.135922201 0.05673190
## bG 0.093611941 0.092357304 0.20025788 0.084325609 0.23116177
## NAG 0.034813061 0.042767729 -0.09443522 0.042036171 0.06368226
## AP 0.052062193 0.087422741 -0.02596542 -0.113315941 -0.11602308
## ALK -0.059690527 0.106052691 0.37043042 -0.103505077 0.26922902
## ARY -0.022452492 0.046967818 -0.01033459 -0.002129443 -0.05796419
## PHO -0.150900411 0.148081989 0.20424421 -0.074155813 0.01478460
## Pro 0.084088431 0.037999749 -0.02494080 0.313324022 0.28328099
## PC16 PC17 PC18 PC19 PC20
## Clay -0.049456636 -0.151374743 -0.06738394 0.083997410 0.1772276403
## TN -0.062734211 0.249646518 0.20086213 -0.124121490 -0.0452436084
## SOC -0.131703986 0.166411822 0.12859353 -0.262399655 -0.0006001951
## Ca -0.034010386 0.026498761 -0.25961016 -0.008932316 0.0336612976
## Cu 0.007780013 -0.090714682 0.13862571 -0.085857378 -0.1726038710
## Mg -0.136847665 -0.027064325 0.01924354 -0.301137003 0.1190950780
## Mn 0.025917475 0.140294334 -0.61442030 0.023984762 -0.0184799406
## Na 0.094090236 0.147251670 -0.01078146 -0.029901264 0.0109759679
## P 0.161698825 0.039545736 0.12036335 0.037808456 0.2262086159
## pH 0.152341410 -0.163107886 0.01169045 0.087387170 -0.1242770926
## K -0.308682480 -0.007804507 -0.01991725 -0.081151835 0.2033730503
## Zn 0.136653749 0.258294572 0.22402261 0.201441503 -0.2503760335
## Fe 0.060440149 0.007785063 0.03277298 -0.205363635 0.2613882433
## CEC -0.075986884 0.035665808 -0.23663518 -0.088472411 0.0761796976
## GWC -0.111021423 0.057016287 -0.02400137 0.366416603 0.1434707142
## BD 0.126854590 -0.036202279 0.14121052 -0.078173547 -0.0796976138
## POXC 0.143952538 0.222650695 -0.28423409 0.144687159 0.2683760568
## MWD -0.237206485 0.016059982 0.11095611 0.395387360 0.2463958607
## Resp 0.050355305 0.060293972 0.01213870 0.225591157 0.1524672452
## MB 0.155808243 -0.083258329 -0.02915388 0.006416782 0.0973796055
## GmP 0.157589703 -0.217518770 0.07904430 -0.139114494 0.1580252678
## GmN -0.401402259 -0.051796649 -0.10835094 0.074740778 -0.1001717072
## Act -0.458646524 0.191724597 0.12989928 0.064203143 -0.0669929870
## AMF 0.066916987 -0.166871414 -0.10670826 -0.028435306 0.1682773455
## Fun 0.468373067 0.274127529 -0.02898833 0.150922683 -0.0820973953
## FB -0.062835268 0.115359087 -0.13263487 0.082202972 -0.0024234966
## bG 0.080473778 -0.548788102 0.18836069 0.149810484 0.1480420080
## NAG -0.027762857 -0.195866380 -0.21413110 -0.096949378 0.0631413478
## AP -0.008399491 -0.038412008 -0.02881928 0.173186097 -0.3015839049
## ALK 0.078095474 0.196744633 0.13502494 -0.197222158 0.3413413913
## ARY -0.039869578 -0.111038944 -0.08893062 -0.125598091 -0.3728468712
## PHO 0.043660994 0.087775763 -0.09737923 -0.397848604 -0.0266282327
## Pro 0.028587920 -0.268322204 -0.23368077 0.009110828 -0.1900749551
## PC21 PC22 PC23 PC24 PC25
## Clay 0.0203687434 0.13637213 0.202528626 -0.047374705 -0.0281629471
## TN -0.1902733403 -0.09098972 -0.099008147 0.180030582 0.0437824081
## SOC -0.1228376773 0.06007155 -0.172980255 0.201299302 -0.3198568620
## Ca -0.0699652959 0.03535872 -0.123209483 0.011273816 0.1071608075
## Cu -0.1517108335 0.02320060 0.073676198 0.124296436 0.0590209865
## Mg 0.1651687247 -0.09691112 -0.028215394 -0.329784666 -0.0909260744
## Mn 0.2790257381 -0.13680844 -0.255851580 -0.059982055 -0.0863428505
## Na -0.1159736935 0.14191569 0.041574153 0.250555387 0.0296889127
## P -0.1996644443 0.09423571 0.448843233 -0.301507804 -0.1550209020
## pH -0.0655055041 -0.05384118 0.149231186 0.029760538 -0.0838195232
## K -0.0715343807 0.34619362 -0.070901080 0.320519489 0.1579888505
## Zn 0.4305014267 0.13918005 0.137839243 -0.074914543 0.2217353906
## Fe 0.0484861298 -0.00656155 -0.098654347 -0.033359941 0.2049552646
## CEC -0.0458407840 0.05509172 -0.120102755 -0.009776226 0.0934315853
## GWC -0.0526320922 0.02415569 -0.152890720 0.031967978 0.0083730602
## BD -0.0333922854 -0.01550855 -0.034077443 -0.014746346 0.0178088928
## POXC -0.0810509006 0.31689341 0.253676726 0.186616853 -0.0268331281
## MWD 0.0595211727 0.07088472 -0.037438296 -0.072046236 -0.1025870882
## Resp -0.0857993822 -0.34285176 0.148453309 0.023611710 -0.3385117980
## MB 0.0999213365 0.08972868 0.041972011 0.023629752 0.1372991755
## GmP 0.1459799821 0.05804830 0.087037572 0.130748260 0.1425292681
## GmN -0.0007044332 -0.01415210 0.085444213 -0.042679394 -0.0156795861
## Act 0.0419095787 -0.05483353 0.135961449 -0.124329602 -0.0660494732
## AMF 0.0976168464 0.15427297 0.155920381 -0.030454846 0.2216339722
## Fun -0.1763739606 0.01855137 -0.253324375 0.021944758 -0.1760538498
## FB 0.0106159427 0.01673121 0.117272414 0.040676315 0.0001967716
## bG 0.0778650257 0.14345202 -0.405134621 0.028876732 -0.2412906508
## NAG -0.5411703374 -0.26884069 0.115903244 -0.041278391 0.1233069281
## AP -0.3330624297 0.18385906 -0.170690826 -0.422423506 0.4085697417
## ALK 0.1359203422 -0.38967774 -0.006765515 0.002874181 0.2917876112
## ARY 0.0621600837 0.09973028 0.241418384 0.341922009 -0.0830124932
## PHO 0.0219860128 0.39577241 0.021882864 -0.388195498 -0.3482205767
## Pro 0.1868071913 -0.23966938 0.208686539 0.066050983 -0.0611083461
## PC26 PC27 PC28 PC29 PC30
## Clay -0.155121496 -0.020136104 0.007966507 0.047986823 0.018378772
## TN -0.416625586 -0.160576980 -0.253588585 0.368218922 -0.490672270
## SOC -0.151790424 -0.238396514 0.179820828 -0.353878202 0.449693368
## Ca -0.008867697 0.140075561 0.045863868 -0.026168505 -0.086560755
## Cu -0.025513283 0.022879125 -0.007923991 -0.064296285 0.140350336
## Mg -0.215306172 0.019062755 0.023899730 0.109481356 -0.025824264
## Mn -0.166058247 -0.058138497 0.035504324 0.242013093 0.217619226
## Na 0.110608782 0.050434112 -0.030604029 -0.084162363 0.025203575
## P -0.281516281 0.169429068 0.112343658 0.086212545 0.088494966
## pH 0.029414209 -0.155110956 -0.470599541 0.350951947 0.455685129
## K 0.234478626 0.156771969 -0.198171296 -0.014034964 -0.027258723
## Zn 0.309024631 -0.166030902 0.154573176 0.160525878 0.030171614
## Fe 0.205985353 0.352293598 -0.318982388 0.212131256 0.208060932
## CEC -0.025835437 0.151710833 0.028047832 -0.010088930 -0.084474393
## GWC -0.056193373 -0.056480896 -0.038065845 0.002250257 0.012719808
## BD 0.020994063 0.031382211 0.005022347 0.022028275 0.032460812
## POXC -0.156703396 -0.106182778 -0.060390437 0.001262059 0.103693365
## MWD 0.046934306 -0.066043927 -0.002048996 0.020615364 -0.015235253
## Resp 0.198864069 0.383760333 -0.092378388 -0.162968179 -0.132205705
## MB -0.050008563 -0.046815116 0.068423000 -0.129555255 -0.023453151
## GmP -0.143394056 -0.233197339 -0.239658925 -0.085223127 0.008252184
## GmN 0.047797226 -0.004281401 -0.035423186 0.032752940 0.022801016
## Act -0.020341076 0.023111295 -0.072165330 0.116800573 0.150925943
## AMF -0.070063977 -0.068326292 0.273417372 -0.001542803 -0.141716471
## Fun 0.049873018 0.085555631 -0.020823180 0.032898800 -0.057035394
## FB -0.031509901 -0.068856923 -0.120268425 -0.022189853 0.016883927
## bG -0.061421876 0.075971274 0.101456360 0.192205351 0.029330188
## NAG 0.371406812 -0.325883528 0.253864295 0.246849257 0.005434487
## AP -0.233442226 0.193010894 -0.140846676 -0.234416189 0.164680502
## ALK -0.038565095 0.139257124 0.070016053 -0.083557116 0.207623869
## ARY -0.149405047 0.473697322 0.265938726 0.262891046 0.064532800
## PHO 0.304455453 -0.042083277 -0.176215494 -0.010105646 -0.172113346
## Pro -0.044340907 -0.052848205 -0.354149787 -0.394863919 -0.176486360
## PC31 PC32 PC33
## Clay 0.008300792 0.023145261 6.757738e-16
## TN 0.098142090 -0.080647751 -1.358134e-15
## SOC 0.082997736 0.030588336 5.439251e-16
## Ca -0.142471773 0.007497049 6.625318e-01
## Cu 0.084044637 -0.017336450 2.845596e-16
## Mg -0.011419024 -0.008943065 1.680908e-01
## Mn -0.001812666 -0.007614541 -9.761637e-17
## Na 0.009509009 -0.010101456 8.962263e-02
## P -0.093244936 0.002231558 5.534002e-16
## pH 0.259318468 -0.050027575 8.744273e-16
## K 0.090489006 0.017675871 5.756129e-02
## Zn -0.126463789 0.046873220 4.818667e-16
## Fe 0.068853773 -0.020144594 3.969150e-16
## CEC -0.124980788 0.004951992 -7.221160e-01
## GWC -0.048078875 0.027665023 2.191872e-17
## BD -0.014348986 -0.003757943 -1.446555e-16
## POXC -0.051717736 0.001896805 7.915032e-16
## MWD 0.034853434 -0.029588193 -4.015579e-17
## Resp -0.033036015 0.024218509 -2.641921e-16
## MB 0.034214529 -0.845681758 2.697627e-16
## GmP -0.566298573 0.317954943 4.629905e-16
## GmN -0.044602259 0.108226784 -8.091862e-18
## Act 0.021901359 -0.023866750 9.716343e-17
## AMF 0.632174479 0.331256221 5.920974e-17
## Fun 0.093923289 0.189990190 -1.906000e-16
## FB -0.166125500 -0.056532663 1.210911e-16
## bG -0.070064300 -0.011721540 -3.339182e-16
## NAG -0.139389527 -0.035920563 3.836405e-16
## AP -0.038413922 0.041331569 -1.920590e-16
## ALK 0.026634068 0.047119992 2.969075e-16
## ARY -0.125797136 0.001909223 -5.101834e-18
## PHO -0.006388057 -0.022461959 -3.721677e-16
## Pro 0.158292862 0.017092847 -6.229820e-16
summary(pc)
## Importance of components:
## PC1 PC2 PC3 PC4 PC5 PC6 PC7
## Standard deviation 3.7487 2.2239 1.63276 1.31987 1.13915 1.11973 1.02587
## Proportion of Variance 0.4258 0.1499 0.08078 0.05279 0.03932 0.03799 0.03189
## Cumulative Proportion 0.4258 0.5757 0.65649 0.70928 0.74860 0.78659 0.81849
## PC8 PC9 PC10 PC11 PC12 PC13 PC14
## Standard deviation 0.96546 0.85277 0.8385 0.77331 0.6599 0.63861 0.58466
## Proportion of Variance 0.02825 0.02204 0.0213 0.01812 0.0132 0.01236 0.01036
## Cumulative Proportion 0.84673 0.86877 0.8901 0.90819 0.9214 0.93375 0.94411
## PC15 PC16 PC17 PC18 PC19 PC20 PC21
## Standard deviation 0.54933 0.50483 0.4666 0.44691 0.38204 0.37434 0.31256
## Proportion of Variance 0.00914 0.00772 0.0066 0.00605 0.00442 0.00425 0.00296
## Cumulative Proportion 0.95325 0.96097 0.9676 0.97362 0.97805 0.98229 0.98525
## PC22 PC23 PC24 PC25 PC26 PC27 PC28
## Standard deviation 0.27519 0.27029 0.26142 0.23057 0.22395 0.21056 0.18542
## Proportion of Variance 0.00229 0.00221 0.00207 0.00161 0.00152 0.00134 0.00104
## Cumulative Proportion 0.98755 0.98976 0.99183 0.99344 0.99496 0.99631 0.99735
## PC29 PC30 PC31 PC32 PC33
## Standard deviation 0.17850 0.16814 0.14841 0.07305 1.665e-15
## Proportion of Variance 0.00097 0.00086 0.00067 0.00016 0.000e+00
## Cumulative Proportion 0.99831 0.99917 0.99984 1.00000 1.000e+00
plot(pc, type="l")

#------
# Plotting PCA using ggbiplot()
#------
ggbiplot(pc)

#------
# Custmoize ggbiplot
#------
# choices = Visualize other PCA components
# obs.scale, var.scale = scale factor to apply to observations and variables
# circle = draw a correlation circle? (only applies when prcomp was called with scale = TRUE and when var.scale = 1)
# ellipse = Draw a normal ellipse for each group
# group = optional factor variable indicating the groups that the observations belong to. If provided the points will be colored according to groups
# labels = Add labels to plot
# alpha = transparency level for the points
# varname.size = size of the text for variable names
# varname.abbrev = Whether to abbreviate variable names or not.
# var.axes = Add or Remove arrows
#------
bplot = ggbiplot(pcobj = pc,
choices = c(1,2),
obs.scale = 1, var.scale = 1,
labels = data$treatment,
varname.size = 3,
varname.abbrev = FALSE,
var.axes = TRUE,
circle = TRUE,
ellipse = TRUE, groups = data$location) +
xlab ("PC1 (42.6%)") + ylab ("PC2 (15.0%)")
bplot2 = bplot + labs(colour = "Locations") + theme_James()+ theme(legend.position = c(0.12,0.7))
bplot2

Less variables- Biologicals
#names(data)
dataless <- data %>%
dplyr::select(-Ca, -Cu, -Mg, -Mn, -Zn, -K, -Na, -Fe, -Clay, -P, -BD, -POXC, -FB, -TN, -CEC, -SOC, -GWC, -pH, -MWD)
names(dataless)
## [1] "sample_pca" "location" "treatment" "Resp" "MB"
## [6] "GmP" "GmN" "Act" "AMF" "Fun"
## [11] "bG" "NAG" "AP" "ALK" "ARY"
## [16] "PHO" "Pro"
Less PCA- subset by location
#------
# Principal component analysis
#------
require(stats)
pcless <- prcomp(x = dataless[, -(1:3)], # Give response variable range
center = TRUE,
scale. = TRUE)
print(pcless)
## Standard deviations (1, .., p=14):
## [1] 3.09709720 1.11135757 0.89461020 0.77813578 0.72524018 0.59465040
## [7] 0.51584079 0.44518034 0.34749999 0.29798465 0.28959127 0.25658002
## [13] 0.23309161 0.09803939
##
## Rotation (n x k) = (14 x 14):
## PC1 PC2 PC3 PC4 PC5 PC6
## Resp -0.2734212 -0.08636836 0.02553070 -0.32320283 0.391327491 -0.42174302
## MB -0.3044981 0.26004702 0.03200824 0.05963233 0.002660584 -0.10651906
## GmP -0.2937375 0.26052945 0.05066433 -0.05849429 -0.090654761 -0.21896469
## GmN -0.2141527 0.26585240 0.14873539 0.63115896 0.601012206 0.16231143
## Act -0.2234559 0.26716293 0.43165845 -0.49998830 -0.084451250 0.45878284
## AMF -0.2972438 0.16896380 -0.01357603 -0.21505939 0.098517220 -0.20151082
## Fun -0.2412742 0.40460289 0.06906523 0.23015944 -0.448747170 0.11574579
## bG -0.2522712 -0.39374791 0.23795834 -0.10496897 0.235166659 0.32683788
## NAG -0.2898857 -0.26262274 0.16174311 0.10725859 -0.186998680 -0.14738549
## AP -0.2835436 -0.31281142 0.05165916 0.01933015 0.018065097 -0.12442666
## ALK -0.2417553 -0.07881716 -0.60351957 -0.06473320 0.062731129 0.53277477
## ARY -0.2849819 -0.01156188 -0.29075602 0.12119165 -0.260477253 -0.18926528
## PHO -0.2801822 -0.01510581 -0.43742468 -0.10090492 0.038974002 0.02219369
## Pro -0.2400941 -0.44079650 0.23829030 0.29838289 -0.308722047 0.08843216
## PC7 PC8 PC9 PC10 PC11 PC12
## Resp 0.25334597 -0.28404327 0.42889030 -0.19718358 0.198767644 -0.21361504
## MB 0.13105813 0.16802096 -0.01914334 -0.06089883 -0.129030936 -0.06834550
## GmP 0.05583222 0.27319477 -0.15628278 -0.05147745 -0.649024457 -0.24007300
## GmN -0.21409081 -0.09839850 0.03969721 -0.01249993 0.014439612 0.03483353
## Act -0.39705089 -0.23729377 0.07889811 -0.05585277 -0.004087142 -0.03351346
## AMF -0.01387628 0.42400361 -0.07978836 -0.06072749 0.238923574 0.40217932
## Fun 0.51443561 -0.19669760 0.05773202 0.20663672 0.345867922 -0.04473728
## bG 0.31436479 0.31083980 -0.43874228 0.02655560 0.235402509 -0.03534666
## NAG -0.08216731 -0.09762566 0.23601994 0.15750263 -0.175591556 0.71310658
## AP 0.05105242 -0.53173723 -0.39665047 0.28858372 -0.239081314 -0.10861216
## ALK 0.23410573 -0.09650661 0.18043836 -0.28040664 -0.265563792 0.14707048
## ARY -0.38818496 -0.17179301 -0.38231188 -0.48576675 0.319626299 -0.04055784
## PHO -0.34139728 0.17934341 0.13995805 0.66891036 0.171441047 -0.22662538
## Pro -0.13028170 0.26852622 0.41221592 -0.18511231 0.013843895 -0.36024381
## PC13 PC14
## Resp 0.160653637 -0.054977256
## MB -0.120058222 0.859363731
## GmP 0.271640628 -0.355256460
## GmN 0.013429755 -0.128705624
## Act -0.007638937 0.016124621
## AMF -0.555319389 -0.262892239
## Fun 0.047414230 -0.179802610
## bG 0.324633926 0.029245467
## NAG 0.333918896 0.070635944
## AP -0.455369263 -0.024914287
## ALK -0.098825360 -0.043664873
## ARY 0.222605849 0.008001439
## PHO 0.143312147 0.026478604
## Pro -0.266482625 -0.069718442
summary(pcless)
## Importance of components:
## PC1 PC2 PC3 PC4 PC5 PC6 PC7
## Standard deviation 3.0971 1.11136 0.89461 0.77814 0.72524 0.59465 0.51584
## Proportion of Variance 0.6851 0.08822 0.05717 0.04325 0.03757 0.02526 0.01901
## Cumulative Proportion 0.6851 0.77337 0.83053 0.87378 0.91135 0.93661 0.95562
## PC8 PC9 PC10 PC11 PC12 PC13 PC14
## Standard deviation 0.44518 0.34750 0.29798 0.28959 0.2566 0.23309 0.09804
## Proportion of Variance 0.01416 0.00863 0.00634 0.00599 0.0047 0.00388 0.00069
## Cumulative Proportion 0.96977 0.97840 0.98474 0.99073 0.9954 0.99931 1.00000
plot(pcless, type="l")

#------
# Plotting PCA using ggbiplot()
#------
ggbiplot(pcless)

#------
# Custmoize ggbiplot
#------
# choices = Visualize other PCA components
# obs.scale, var.scale = scale factor to apply to observations and variables
# circle = draw a correlation circle? (only applies when prcomp was called with scale = TRUE and when var.scale = 1)
# ellipse = Draw a normal ellipse for each group
# group = optional factor variable indicating the groups that the observations belong to. If provided the points will be colored according to groups
# labels = Add labels to plot
# alpha = transparency level for the points
# varname.size = size of the text for variable names
# varname.abbrev = Whether to abbreviate variable names or not.
# var.axes = Add or Remove arrows
#------
bplotl = ggbiplot(pcobj = pcless,
choices = c(1,2),
obs.scale = 1, var.scale = 1,
#labels = data$treatment,
varname.size = 3,
varname.abbrev = FALSE,
var.axes = TRUE,
circle = TRUE,
ellipse = TRUE, groups = data$location) +
xlab ("PC1 (68.5%)") + ylab ("PC2 (8.8%)") +
labs(colour = "Locations") +
theme_James()+ theme(legend.position = c(0.12,0.8))
bplotl

ggsave("locationbiplot1.png", height=6, width=9)
Less PCA- subset by land use
#------
# Principal component analysis
#------
require(stats)
pcless <- prcomp(x = dataless[, -(1:3)], # Give response variable range
center = TRUE,
scale. = TRUE)
print(pcless)
## Standard deviations (1, .., p=14):
## [1] 3.09709720 1.11135757 0.89461020 0.77813578 0.72524018 0.59465040
## [7] 0.51584079 0.44518034 0.34749999 0.29798465 0.28959127 0.25658002
## [13] 0.23309161 0.09803939
##
## Rotation (n x k) = (14 x 14):
## PC1 PC2 PC3 PC4 PC5 PC6
## Resp -0.2734212 -0.08636836 0.02553070 -0.32320283 0.391327491 -0.42174302
## MB -0.3044981 0.26004702 0.03200824 0.05963233 0.002660584 -0.10651906
## GmP -0.2937375 0.26052945 0.05066433 -0.05849429 -0.090654761 -0.21896469
## GmN -0.2141527 0.26585240 0.14873539 0.63115896 0.601012206 0.16231143
## Act -0.2234559 0.26716293 0.43165845 -0.49998830 -0.084451250 0.45878284
## AMF -0.2972438 0.16896380 -0.01357603 -0.21505939 0.098517220 -0.20151082
## Fun -0.2412742 0.40460289 0.06906523 0.23015944 -0.448747170 0.11574579
## bG -0.2522712 -0.39374791 0.23795834 -0.10496897 0.235166659 0.32683788
## NAG -0.2898857 -0.26262274 0.16174311 0.10725859 -0.186998680 -0.14738549
## AP -0.2835436 -0.31281142 0.05165916 0.01933015 0.018065097 -0.12442666
## ALK -0.2417553 -0.07881716 -0.60351957 -0.06473320 0.062731129 0.53277477
## ARY -0.2849819 -0.01156188 -0.29075602 0.12119165 -0.260477253 -0.18926528
## PHO -0.2801822 -0.01510581 -0.43742468 -0.10090492 0.038974002 0.02219369
## Pro -0.2400941 -0.44079650 0.23829030 0.29838289 -0.308722047 0.08843216
## PC7 PC8 PC9 PC10 PC11 PC12
## Resp 0.25334597 -0.28404327 0.42889030 -0.19718358 0.198767644 -0.21361504
## MB 0.13105813 0.16802096 -0.01914334 -0.06089883 -0.129030936 -0.06834550
## GmP 0.05583222 0.27319477 -0.15628278 -0.05147745 -0.649024457 -0.24007300
## GmN -0.21409081 -0.09839850 0.03969721 -0.01249993 0.014439612 0.03483353
## Act -0.39705089 -0.23729377 0.07889811 -0.05585277 -0.004087142 -0.03351346
## AMF -0.01387628 0.42400361 -0.07978836 -0.06072749 0.238923574 0.40217932
## Fun 0.51443561 -0.19669760 0.05773202 0.20663672 0.345867922 -0.04473728
## bG 0.31436479 0.31083980 -0.43874228 0.02655560 0.235402509 -0.03534666
## NAG -0.08216731 -0.09762566 0.23601994 0.15750263 -0.175591556 0.71310658
## AP 0.05105242 -0.53173723 -0.39665047 0.28858372 -0.239081314 -0.10861216
## ALK 0.23410573 -0.09650661 0.18043836 -0.28040664 -0.265563792 0.14707048
## ARY -0.38818496 -0.17179301 -0.38231188 -0.48576675 0.319626299 -0.04055784
## PHO -0.34139728 0.17934341 0.13995805 0.66891036 0.171441047 -0.22662538
## Pro -0.13028170 0.26852622 0.41221592 -0.18511231 0.013843895 -0.36024381
## PC13 PC14
## Resp 0.160653637 -0.054977256
## MB -0.120058222 0.859363731
## GmP 0.271640628 -0.355256460
## GmN 0.013429755 -0.128705624
## Act -0.007638937 0.016124621
## AMF -0.555319389 -0.262892239
## Fun 0.047414230 -0.179802610
## bG 0.324633926 0.029245467
## NAG 0.333918896 0.070635944
## AP -0.455369263 -0.024914287
## ALK -0.098825360 -0.043664873
## ARY 0.222605849 0.008001439
## PHO 0.143312147 0.026478604
## Pro -0.266482625 -0.069718442
summary(pcless)
## Importance of components:
## PC1 PC2 PC3 PC4 PC5 PC6 PC7
## Standard deviation 3.0971 1.11136 0.89461 0.77814 0.72524 0.59465 0.51584
## Proportion of Variance 0.6851 0.08822 0.05717 0.04325 0.03757 0.02526 0.01901
## Cumulative Proportion 0.6851 0.77337 0.83053 0.87378 0.91135 0.93661 0.95562
## PC8 PC9 PC10 PC11 PC12 PC13 PC14
## Standard deviation 0.44518 0.34750 0.29798 0.28959 0.2566 0.23309 0.09804
## Proportion of Variance 0.01416 0.00863 0.00634 0.00599 0.0047 0.00388 0.00069
## Cumulative Proportion 0.96977 0.97840 0.98474 0.99073 0.9954 0.99931 1.00000
plot(pcless, type="l")

#------
# Plotting PCA using ggbiplot()
#------
ggbiplot(pcless)

#------
# Custmoize ggbiplot
#------
# choices = Visualize other PCA components
# obs.scale, var.scale = scale factor to apply to observations and variables
# circle = draw a correlation circle? (only applies when prcomp was called with scale = TRUE and when var.scale = 1)
# ellipse = Draw a normal ellipse for each group
# group = optional factor variable indicating the groups that the observations belong to. If provided the points will be colored according to groups
# labels = Add labels to plot
# alpha = transparency level for the points
# varname.size = size of the text for variable names
# varname.abbrev = Whether to abbreviate variable names or not.
# var.axes = Add or Remove arrows
#------
# Group by land use
bplotlu = ggbiplot(pcobj = pcless,
choices = c(1,2),
obs.scale = 1, var.scale = 1,
#labels = data$treatment,
varname.size = 3,
varname.abbrev = FALSE,
var.axes = TRUE,
circle = TRUE,
ellipse = TRUE, groups = data$treatment) +
xlab ("PC1 (68.5%)") + ylab ("PC2 (8.8%)") +
labs(colour = "Locations") +
theme_James()+ theme(legend.position = c(0.12,0.8))
bplotlu

ggsave("landusebiplot1.png", height=6, width=9)
#Group by Depth
bplotlud = ggbiplot(pcobj = pcless,
choices = c(1,2),
obs.scale = 1, var.scale = 1,
#labels = data$treatment,
varname.size = 3,
varname.abbrev = FALSE,
var.axes = TRUE,
circle = TRUE,
ellipse = TRUE, groups = data$treatment) +
xlab ("PC1 (68.5%)") + ylab ("PC2 (8.8%)") +
labs(colour = "Locations") +
theme_James()+ theme(legend.position = c(0.12,0.8))
bplotlud

ggsave("landusebiplot2.png", height=6, width=9)
Less PCA- subset by land use- with C and N
#------
# Principal component analysis
#------
cndataless <- data %>%
dplyr::select(-Ca, -Cu, -Mg, -Mn, -Zn, -K, -Na, -Fe, -Clay, -P, -BD, -POXC, -FB, -CEC, -GWC, -pH, -MWD)
require(stats)
cnpcless <- prcomp(x = cndataless[, -(1:3)], # Give response variable range
center = TRUE,
scale. = TRUE)
print(cnpcless)
## Standard deviations (1, .., p=16):
## [1] 3.34507754 1.16758090 0.89668490 0.78195056 0.73561526 0.60688534
## [7] 0.51718446 0.45015074 0.43750248 0.32630463 0.31058678 0.29288299
## [13] 0.26018798 0.22961615 0.20692969 0.09378996
##
## Rotation (n x k) = (16 x 16):
## PC1 PC2 PC3 PC4 PC5 PC6
## TN -0.2716862 -0.25070261 0.02679830 -0.042047039 0.141885082 -0.05555664
## SOC -0.2711168 -0.17511352 0.06271726 -0.102294520 0.091323133 -0.23041276
## Resp -0.2555447 -0.05797849 -0.03190335 0.287174582 0.412046917 -0.36107338
## MB -0.2773827 0.28673909 -0.02473236 -0.064195239 0.002315997 -0.09200401
## GmP -0.2668590 0.29090241 -0.04688203 0.059240881 -0.070705688 -0.20570797
## GmN -0.1962753 0.25461945 -0.11926155 -0.683955513 0.522544135 0.22769078
## Act -0.1998612 0.30946765 -0.43553735 0.490306189 -0.014003416 0.37630432
## AMF -0.2721379 0.19975597 0.01403029 0.201077251 0.119890546 -0.18899968
## Fun -0.2154123 0.42796032 -0.05914343 -0.198112319 -0.442828069 0.08183075
## bG -0.2372788 -0.32229892 -0.26782185 0.122930913 0.167120948 0.39919625
## NAG -0.2711882 -0.20041080 -0.18255487 -0.070545445 -0.226842973 -0.11502605
## AP -0.2666156 -0.25584614 -0.07478563 0.007246757 -0.027221564 -0.05629380
## ALK -0.2247710 -0.05067622 0.58524432 0.105918979 0.005086819 0.55978669
## ARY -0.2630274 0.02924389 0.27932291 -0.076557165 -0.295546438 -0.16269843
## PHO -0.2601746 0.01065150 0.42698130 0.120257212 0.019915447 0.03910076
## Pro -0.2279692 -0.37361691 -0.26536223 -0.241059038 -0.380951601 0.09841406
## PC7 PC8 PC9 PC10 PC11
## TN 0.041831525 -0.26584889 0.36369449 -0.113078098 0.32678364
## SOC 0.091990365 -0.14218466 0.58078861 -0.334949657 -0.27315194
## Resp -0.287816919 -0.22854610 -0.14638336 0.465386817 -0.27435077
## MB -0.140520331 0.16656452 0.02555178 0.002984395 0.03111478
## GmP -0.076262839 0.27535928 -0.02585816 -0.030838333 0.39986130
## GmN 0.199940106 -0.03797115 -0.14674511 0.084654223 -0.03478460
## Act 0.442280842 -0.28220770 0.08800876 0.012318537 -0.07314555
## AMF -0.004575324 0.43339535 0.06561762 -0.090363051 -0.17488999
## Fun -0.484131136 -0.27424844 0.13922444 -0.047448953 -0.02781797
## bG -0.328276090 0.40244616 -0.12987467 -0.351624452 -0.09193702
## NAG 0.057650283 -0.04014645 -0.15171192 0.349038185 0.10333758
## AP -0.087357313 -0.38202394 -0.47652359 -0.328938398 0.30170856
## ALK -0.210913264 -0.10565783 0.04640694 0.209207557 -0.12783021
## ARY 0.350450662 -0.02017160 -0.40149586 -0.258667401 -0.47878815
## PHO 0.329600259 0.18183973 0.01151114 0.122825217 0.41930071
## Pro 0.129377760 0.23458106 0.15572024 0.400389516 -0.11403281
## PC12 PC13 PC14 PC15 PC16
## TN -0.1244567451 -0.16264754 -0.0741813884 0.673044811 0.113672866
## SOC 0.0002275771 0.17240234 -0.0771203833 -0.474441763 -0.080254680
## Resp 0.0821417058 -0.27673246 -0.0948385074 -0.055666359 -0.062588291
## MB -0.1402871622 -0.02653569 0.1284941494 -0.132076326 0.850986229
## GmP -0.5507891024 -0.12548307 -0.2596796489 -0.166773885 -0.365554997
## GmN 0.0238743762 0.02660943 0.0010070240 0.002307228 -0.130837032
## Act -0.0377191728 -0.01758994 -0.0003910409 -0.045332124 0.010144894
## AMF 0.1391670623 0.32293078 0.5186107139 0.341929107 -0.234265896
## Fun 0.3799873407 -0.10010949 -0.0495261672 0.083976890 -0.170255741
## bG 0.1727496084 -0.09244396 -0.3284539737 0.004213954 0.026810380
## NAG 0.0760499453 0.70166269 -0.3406487647 0.062474086 0.069166466
## AP -0.0232651834 0.04354947 0.4689055367 -0.221568094 -0.051224715
## ALK -0.3383644248 0.18365574 0.0978632487 -0.036143172 -0.052723161
## ARY -0.0931718782 -0.19559102 -0.2371709143 0.218122632 0.030460205
## PHO 0.5669863167 -0.18217054 -0.0803579896 -0.198904600 0.009038373
## Pro -0.0902843024 -0.35710530 0.3288148682 -0.077918359 -0.076860679
summary(cnpcless)
## Importance of components:
## PC1 PC2 PC3 PC4 PC5 PC6 PC7
## Standard deviation 3.3451 1.1676 0.89668 0.78195 0.73562 0.60689 0.51718
## Proportion of Variance 0.6994 0.0852 0.05025 0.03822 0.03382 0.02302 0.01672
## Cumulative Proportion 0.6994 0.7845 0.83480 0.87302 0.90684 0.92986 0.94657
## PC8 PC9 PC10 PC11 PC12 PC13 PC14
## Standard deviation 0.45015 0.43750 0.32630 0.31059 0.29288 0.26019 0.2296
## Proportion of Variance 0.01266 0.01196 0.00665 0.00603 0.00536 0.00423 0.0033
## Cumulative Proportion 0.95924 0.97120 0.97786 0.98389 0.98925 0.99348 0.9968
## PC15 PC16
## Standard deviation 0.20693 0.09379
## Proportion of Variance 0.00268 0.00055
## Cumulative Proportion 0.99945 1.00000
plot(cnpcless, type="l")

#------
# Plotting PCA using ggbiplot()
#------
ggbiplot(cnpcless)

#------
# Custmoize ggbiplot
#------
# choices = Visualize other PCA components
# obs.scale, var.scale = scale factor to apply to observations and variables
# circle = draw a correlation circle? (only applies when prcomp was called with scale = TRUE and when var.scale = 1)
# ellipse = Draw a normal ellipse for each group
# group = optional factor variable indicating the groups that the observations belong to. If provided the points will be colored according to groups
# labels = Add labels to plot
# alpha = transparency level for the points
# varname.size = size of the text for variable names
# varname.abbrev = Whether to abbreviate variable names or not.
# var.axes = Add or Remove arrows
#------
# Group by land use
bplotlucn = ggbiplot(pcobj = cnpcless,
choices = c(1,2),
obs.scale = 1, var.scale = 1,
#labels = data$treatment,
varname.size = 3,
varname.abbrev = FALSE,
var.axes = TRUE,
circle = TRUE,
ellipse = TRUE, groups = data$treatment) +
xlab ("PC1 (69.9%)") + ylab ("PC2 (8.5%)") +
labs(colour = "Locations") +
theme_James()+ theme(legend.position = c(0.12,0.8))
ggsave("cnlandusebiplot1.png", height=6, width=9)
#Group by Depth
bplotludcn = ggbiplot(pcobj = cnpcless,
choices = c(1,2),
obs.scale = 1, var.scale = 1,
#labels = data$treatment,
varname.size = 3,
varname.abbrev = FALSE,
var.axes = TRUE,
circle = TRUE,
ellipse = TRUE, groups = data$treatment) +
xlab ("PC1 (69.9%)") + ylab ("PC2 (8.5%)") +
labs(colour = "Locations") +
theme_James()+ theme(legend.position = c(0.12,0.8))
bplotludcn

ggsave("cnlandusebiplot6.png", height=6, width=9)
ggsave("cnbiplotall.png", height=6, width=9)