parabolasingle = function(r,k,noise,n0,nostep,maxr) { # plots a state space rendering of the May's equation #r - intrinsic growth rate #k - carrying capacity #n0 - initial population size #nostep - number of steps for simulation #maxr is used to plot everything in the same scale if called several times if (maxr < r) maxr=r; x=seq(0,100,by=k/100) titl = paste("R value:",r) matplot(x,cbind(x,r*x*(k-x)/k),type="l",lty=1,lwd=2,col=c("green","blue"), xlim = c(0,k), ylim=c(0,maxr*k/2),main=titl, xlab="Population size at the step t", ylab = "Population size at the step t+1") n=maysingle(r,k,noise,n0,nostep); for (t in 1:(nostep-1)) { lines(c(n[t], n[t]),c(n[t],n[t+1]),col="red") lines(c(n[t], n[t+1]),c(n[t+1],n[t+1]),col="red") } }