function metapop2_plot(imi1,ext1,ini1,imi2,ext2,ini2,domcon,dim, nostep, animation) %This function plots simulated metapopulation dynamics and isolines together % imi - immigration rate % ext - extinction rate % ini - proportion of habitats initially occupied (0 - one individual in the centre) % 1 and 2 refer to first (green) and second (blue) species % domcon - 1: dominance control by the first species; 0: founder control % dim - number of rows of cells (dim^2 is the number of habitats) % iffig - whether to draw a spatial figure % nostep - number of simulation steps x=metapop2(imi1,ext1,ini1,imi2,ext2,ini2,domcon,dim, 0, nostep); y=metapop2_lines(imi1,ext1,imi2,ext2,domcon); if (~domcon) plot(y(1,:),y(2:3,:)); axis([0, max(y(1,:)), 0, max(max(y(2:3,:)))]) else plot(y(1,:),y(2,:),'g-'); axis([0, max(y(1,:)), 0, max(y(2,:))]) line([1-ext1/imi1 1-ext1/imi1 ],[0 max(max(x(2,:)),max(y(2,:)))],'color','b'); end hold on; if (animation > 0) for i=1:nostep-1 title(i); plot([x(1,i),x(1,i+1)],[x(2,i),x(2,i+1)],'r.-'); pause(0.1); end else plot(x(1,:),x(2,:),'r'); end