rm(list=ls())
require(geomorph)
nomall="Ai_SouthAf.TPS"
Lycan=readland.tps(nomall)
wid=10; hgt=4
quartz(width=wid, height=hgt)
old=par(mar=c(1,1,0.2,0.2))
gpa=gpagen(Lycan)
plot(gpa)
mtext("All",side=1,line=-2, adj=0.9, col='black',cex=2)
mals=readland.tps("Ai_SouthAf_mals.TPS")
nmal=length(mals[1,1,])
gpm=gpagen(mals)
quartz(width=wid, height=hgt)
old=par(mar=c(1,1,0.2,0.2))
plot(gpm)
mtext("Males",side=1,line=-2, adj=0.9, col='blue',cex=2)
fems=readland.tps("Ai_SouthAf_fems.TPS")
gpf=gpagen(fems)
nfem=length(fems[1,1,])
quartz(width=wid, height=hgt)
old=par(mar=c(1,1,0.2,0.2))
plot(gpf)
mtext("Females",side=1,line=-2, adj=0.9, col='red',cex=2)
fem=mshape(gpa$coords[,,1:nfem])
male=mshape(gpa$coords[,,(nfem+1):(nfem+nmal)])
sex=rep(NaN,nmal+nfem); sex[1:nfem]=1;sex[(nfem+1):(nmal+nfem)]=-1

quartz(width=wid, height=hgt)
old=par(mar=c(1,1,0.2,0.2))
plot(fem, col='red',pch=20)
points(male, col='blue', pch=20)
outl=c(1:4,9,15,29,30,31,19,22,26,NaN,5:9,NaN,3,7,4,8,3,NA,17,10:15,NaN,16:19,NaN,17,18,21,17,NaN,23:26,23,NaN,26,27,21,NaN,11,18,NaN,20,23,24,21,NaN,14,28:30,28,NaN,12,31)
lines(male[outl,], col='blue')
mtext(nomall,side=1,line=-2,adj=0.85)
mtext(paste(nmal,"males"),side=1,line=-1,adj=0.75,col='blue')
mtext(paste(nfem,"females"),side=1,line=-1,adj=0.95,col='red')
quartz()
boxplot(gpa$Csize~sex, main=paste(nomall,"Csize vs sex"))
mtext('male',side=1,line=3,col='blue', adj=0.25, cex=2)
mtext('female',side=1,line=3,col='red', adj=0.75, cex=2)
quartz()
hist(gpa$Csize)
hist(gpm$Csize, add=TRUE,col='blue')
hist(gpf$Csize, add=TRUE,col='red')
mtext(nomall)
