figure(10)
hold off

xaxispts=log(plotOutData1(indx,8)+plotOutData1(indx,6)+plotOutData1(indx,7))/log(10);
plot([-8],[0],'ks',[-8],[-1],'ko',[-8],[-2],'k^')
legend('Plant','Herbivore','Carnivore','location','nw')

    
hold on

if stdon==0

    plot(xaxispts,plotOutData1(indx,9),'bs', ...
    xaxispts,plotOutData1(indx,10),'mo', ...
    xaxispts,plotOutData1(indx,11),'r^')

hold on
end

%Bms=plotOutData1(:,8)+plotOutData1(:,6)+plotOutData1(:,7)+1e-6;
Bms=log(plotOutData1(:,8)+plotOutData1(:,6)+plotOutData1(:,7))/log(10);

%yBms=log(plotOutData1(:,2))/log(10);


yBms=Bms;

XX=yBms(indx1)';
YY1=plotOutData1(indx1,9)';
YY2=plotOutData1(indx1,10)';
YY3=plotOutData1(indx1,11)';
YY0=bmscale*log((plotOutData1(indx1,8)+plotOutData1(indx1,6)+plotOutData1(indx1,7))')/log(10);
[aa,bb]=sort(XX);

%yyBms=sort(yBms);
yyBms=yBms(yBms>-Inf);
yyBms=sort(yyBms);
yBmsm=max([yyBms(1), min(yBms)]);
yBmsM=max(yBms);

BinNmbr=floor(sum(OutData(:,1)==1)/1.0);
Binsize=(log(max(OutData(:,2)))/log(10)-log(min(OutData(:,2)))/log(10))/BinNmbr;%30;
yBinsize=Binsize;

yBmsBins=yBmsm:yBinsize:yBmsM;


yzpms=[];
y1nmbr=[];
z1nmbr=[];
p1nmbr=[];
yzpstd=[];
y1std=[];
z1std=[];
p1std=[];
for i=yBmsBins
    ind1=(yBms>=i & yBms<i+yBinsize);
    yzpms=[yzpms, mean(Bms(ind1))];
    y1nmbr=[y1nmbr, mean(plotOutData1(ind1,9))];
    z1nmbr=[z1nmbr, mean(plotOutData1(ind1,10))];
    p1nmbr=[p1nmbr, mean(plotOutData1(ind1,11))];
    yzpstd=[yzpstd, std(Bms(ind1))];
    y1std=[y1std, std(plotOutData1(ind1,9))];
    z1std=[z1std, std(plotOutData1(ind1,10))];
    p1std=[p1std, std(plotOutData1(ind1,11))];
end

if stdon==0


    plot(aa,YY1(bb),'bs',aa,YY1(bb),'k-',...
        aa,YY2(bb),'ms',aa,YY2(bb),'k-',...
        aa,YY3(bb),'rs',aa,YY3(bb),'k-')
    hold on

end


plot(yBmsBins+yBinsize/2,y1nmbr,'ks',yBmsBins+yBinsize/2,z1nmbr,'ko',...
    yBmsBins+yBinsize/2,p1nmbr,'k^',...
    yBmsBins+yBinsize/2,y1nmbr,'g-',yBmsBins+yBinsize/2,z1nmbr,'b-',...
    yBmsBins+yBinsize/2,p1nmbr,'r-', ...
    'linewidth', 2.5)

if stdon==1
hold on
for j=1:length(yBmsBins)
    plot([yBmsBins(j)+yBinsize/2 yBmsBins(j)+yBinsize/2],...
        [z1nmbr(j)+z1std(j) z1nmbr(j)-z1std(j)], 'b-','linewidth',1.5)
end

for j=1:length(yBmsBins)
    plot([yBmsBins(j)+yBinsize/2 yBmsBins(j)+yBinsize/2],...
        [y1nmbr(j)+y1std(j) y1nmbr(j)-y1std(j)], 'g.',...
        [yBmsBins(j)+yBinsize/2 yBmsBins(j)+yBinsize/2],...
        [p1nmbr(j)+p1std(j) p1nmbr(j)-p1std(j)], 'r-')
end

end
ylabel('Number of Species','fontsize',16)
xlabel('log(Web Biomass)','fontsize',16)

axis([yBmsm yBmsM 0 par0values(2)])
axis([yBmsm yBmsM 0 160])

%%

stdon=1; % binary.

bmscale=1;
Binsize=(log(pta1)/log(10)-log(pta0)/log(10))/sum(plotOutData(:,1)==1);

r0ini=1e+1;
r0end=1e+2;

%figplot2main;

%figplot2main;

Npts=20;
figure(11)
for i=1:4
subplot(2,2,i)
hold off
xaxis=5;
r0ini=10^i;
r0end=10^(i+1);
figplot2main;
end


return



