Allozyme_data<-matrix(NA, nrow=9,ncol=20)
Lap1<-c(0,0,0,0,0,0,0,0.025,0.030)
Lap2<-c(0,0,0,0,0,0,0,0,0.030)
Lap3<-c(0,0,0,0,0,0,0,0.350,0)
Lap4<-c(0,0.214,0.250,0,0.140,0,0.024,0.475,0.156)
Lap5<-c(0.167,0.119,0.286,0.278,0.160,0.136,0.119,0,0.345)
Lap6<-c(0.833,0.667,0.214,0.611,0.580,0.705,0.666,0,0.345)
Lap7<-c(0,0,0.250,0.111,0.120,0.091,0.167,0.150,0.094)
Lap8<-c(0,0,0,0,0,0.068,0.024,0,0)
Mpi1<-c(0,0.024,0,0,0.040,0.023,0.050,0,0)
Mpi2<-c(0.167,0,0.107,0,0.060,0.068,0.025,0,0)
Mpi3<-c(0.833,0.262,0.107,0.056,0.360,0.045,0.125,0.263,0.500)
Mpi4<-c(0,0.547,0.607,0.721,0.460,0.546,0.650,0.737,0.406)
Mpi5<-c(0,0.143,0.143,0.167,0.080,0.273,0.150,0,0.094)
Mpi6<-c(0,0.024,0.036,0.056,0,0.045,0,0,0)
Pgi1<-c(0,0,0.036,0,0.040,0,0.190,0.265,0.056)
Pgi2<-c(0,0,0,0,0,0.023,0,0,0)
Pgi3<-c(0.667,0.095,0.214,0.111,0.140,0.931,0.525,0.059,0.167)
Pgi4<-c(0.333,0.429,0.214,0.278,0.240,0.023,0.190,0.529,0.527)
Pgi5<-c(0,0.309,0.429,0.444,0.480,0.023,0.095,0.147,0.250)
Pgi6<-c(0,0.167,0.107,0.167,0.100,0,0,0,0)
Allozyme_data[,1]<-Lap1
Allozyme_data[,2]<-Lap2
Allozyme_data[,3]<-Lap3
Allozyme_data[,4]<-Lap4
Allozyme_data[,5]<-Lap5
Allozyme_data[,6]<-Lap6
Allozyme_data[,7]<-Lap7
Allozyme_data[,8]<-Lap8
Allozyme_data[,9]<-Mpi1
Allozyme_data[,10]<-Mpi2
Allozyme_data[,11]<-Mpi3
Allozyme_data[,12]<-Mpi4
Allozyme_data[,13]<-Mpi5
Allozyme_data[,14]<-Mpi6
Allozyme_data[,15]<-Pgi1
Allozyme_data[,16]<-Pgi2
Allozyme_data[,17]<-Pgi3
Allozyme_data[,18]<-Pgi4
Allozyme_data[,19]<-Pgi5
Allozyme_data[,20]<-Pgi6
rownames <-c("Trat", "Chon_Buri", "Chumphon_5", "Chumphon_6", "Surat_Thani", "Satun", "Trang", "Sydney_Aust", "Magnetic_Island")
colnames(Allozyme_data)<-c( "Lap1", "Lap2", "Lap3", "Lap4","Lap5", "Lap6"," Lap7","Lap8", "Mpi1","Mpi2","Mpi3", "Mpi4", "Mpi5","Mpi6", "Pgi1","Pgi2","Pgi3","Pgi4","Pgi5","Pgi6")
pca1<-prcomp(t(Allozyme_data), scale. = TRUE)
head(pca1$rotation,3)
colours1<-c("orange","orange","orange","orange","orange","orange", "orange", "blue","blue")
par(mfrow=c(2,2))
plot(pca1$rotation[,1], pca1$rotation[,2], col=colours1, pch=15)
plot(pca1$rotation[,2], pca1$rotation[,3], col=colours1, pch=15)
plot(pca1$rotation[,1], pca1$rotation[,3], col=colours1, pch=15)
plot(pca1$rotation[,2], pca1$rotation[,4], col=colours1, pch=15)
par(mfrow=c(1,1))
localities<-c("Trat", "Chon_Buri", "Chumphon_5", "Chumphon_6", "Surat_Thani", "Satun", "Trang", "Sydney_Aust", "Magnetic_Island")
plot(pca1$rotation[,1], pca1$rotation[,2], col=colours1, pch=15)
xoffset<-0.01*(max(pca1$rotation[,1])-min(pca1$rotation[,1]))
yoffset<-0.02*(max(pca1$rotation[,2])-min(pca1$rotation[,2]))
text(pca1$rotation[,1]+xoffset, pca1$rotation[,2]+yoffset,localities,cex=0.7,xpd=NA)