plotpoints<-function(all,gen){ plot (NULL,axes=F,xlim=c(0,100),ylim=c(0,100),ylab="",xlab="",main="") for(j in 1:length(all)){ x<-sample(1:1000000,1)/10000 y<-sample(1:1000000,1)/10000 points(x,y,pch=15,col=alleles[j])} # end j loop text(xpd=NA,50,110,paste("generation = ",gen,sep=""),cex=0.8) } par(mfrow=c(3,2)) par(mar=c(2,2,2,2)) alleles<-c(rep("red",200), rep("blue",200), rep("green",200), rep("yellow",200), rep("turquoise",200)) alleles<-sample(alleles,1000,replace=F) plotlist<-c(1,5,10,25,50,100) for(i in 1:100){ if(i %in% plotlist) plotpoints(alleles,i) breeders<-sample(alleles,100,replace=F) alleles<- rep(breeders,10) }