figure(xaxis)
hold off
if xaxis==2
xaxispts=log(plotOutData(indx,xaxis))/log(10);
plot([-8],[0],'kv',[-8],[0],'ks',[-8],[0],'ko',[-8],[0],'k^')
legend('20*log(Total Biomass)','Plant','Herbivore','Carnivore','location','ne')
xlabel('log(r_0)','fontsize',16)
ylabel('Number of Species','fontsize',16)

else
    xaxispts=log(plotOutData(indx,8)+plotOutData(indx,6)+plotOutData(indx,7))/log(10);
plot([-8],[0],'ks',[-8],[0],'ko',[-8],[0],'k^')
legend('t1','t1','t1','location','nw')
end
    
hold on

if stdon==0

if xaxis==2
plot(xaxispts,bmscale*log(plotOutData(indx,8)+plotOutData(indx,6)+plotOutData(indx,7))/log(10),'yo', ...
    xaxispts,plotOutData(indx,end-2),'bo', ...
    xaxispts,plotOutData(indx,end-1),'mo', ...
    xaxispts,plotOutData(indx,end),'ro')
hold on
else
    plot(xaxispts,plotOutData(indx,end-2),'bo', ...
    xaxispts,plotOutData(indx,end-1),'mo', ...
    xaxispts,plotOutData(indx,end),'ro')

hold on

end

end

%if xaxis==2
%yBms=log(plotOutData(:,xaxis))/log(10);
%else
%yBms=log(plotOutData(:,8)+plotOutData(:,6)+plotOutData(:,7))/log(10);
%end

Bms=plotOutData(:,8)+plotOutData(:,6)+plotOutData(:,7);

if xaxis==2
yBms=log(plotOutData(:,xaxis))/log(10);
else
yBms=Bms;
end

Bms=log(Bms+1e-6)/log(10);
Bms=bmscale*Bms;


%[aa,bb]=sort(yBms(indx1));
%plot(yBms(indx1),plotOutData(indx1,end-2),'k-', ...
%    yBms(indx1),plotOutData(indx1,end-1),'k-', ...
%    yBms(indx1),plotOutData(indx1,end),'k-',...
%    'linewidth', 1)

XX=yBms(indx1)';
YY1=plotOutData(indx1,end-2)';
YY2=plotOutData(indx1,end-1)';
YY3=plotOutData(indx1,end)';
YY0=bmscale*log((plotOutData(indx1,8)+plotOutData(indx1,6)+plotOutData(indx1,7))')/log(10);

[aa,bb]=sort(XX);

if stdon==0

if xaxis==2
    plot(aa,YY0(bb),'ys',aa,YY0(bb),'k-',...
        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    
else
    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

end





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

yBmsBins=yBmsm:yBinsize:yBmsM;


yzpms=[];
y1nmbr=[];
z1nmbr=[];
p1nmbr=[];
yzpstd=[];
y1std=[];
z1std=[];
p1std=[];

pbms=[];
hbms=[];
cbms=[];
pstd=[];
hstd=[];
cstd=[];

%if xaxis==2
plotOutData1=[];
plotOutData1(:,6:8)=log(plotOutData(:,6:8))/log(10);
plotOutData1(:,6:8)=plotOutData(:,6:8);

%plotOutData1(:,6:8)=plotOutData(:,6:8);

%end

for i=yBmsBins
    ind1=(yBms>=i & yBms<i+yBinsize);    
    pbms=[pbms,mean(plotOutData1(ind1,6))];
    hbms=[hbms,mean(plotOutData1(ind1,7))];
    cbms=[cbms,mean(plotOutData1(ind1,8))];
    pstd=[pstd,std(plotOutData1(ind1,6))];
    hstd=[hstd,std(plotOutData1(ind1,7))];
    cstd=[cstd,std(plotOutData1(ind1,8))];
    y1nmbr=[y1nmbr, mean(plotOutData(ind1,end-2))];
    z1nmbr=[z1nmbr, mean(plotOutData(ind1,end-1))];
    p1nmbr=[p1nmbr, mean(plotOutData(ind1,end))];
    yzpms=[yzpms, mean(Bms(ind1))];
    yzpstd=[yzpstd, std(Bms(ind1))];
%        yzpms=[yzpms, mean(plotOutData1(ind1,6)+plotOutData1(ind1,7)+plotOutData1(ind1,8))];
%        yzpstd=[yzpstd, std(plotOutData1(ind1,6)+plotOutData1(ind1,7)+plotOutData1(ind1,8))];
    y1std=[y1std, std(plotOutData(ind1,end-2))];
    z1std=[z1std, std(plotOutData(ind1,end-1))];
    p1std=[p1std, std(plotOutData(ind1,end))];
end

if xaxis==2
    plot(yBmsBins+yBinsize/2,yzpms,'kv',yBmsBins+yBinsize/2,yzpms,'y-','linewidth', 2.5)

    hold on
    if stdon==1
    for j=1:length(yBmsBins)
        plot([yBmsBins(j)+yBinsize/2 yBmsBins(j)+yBinsize/2],[yzpms(j)+yzpstd(j) yzpms(j)-yzpstd(j)], 'yx')
    end
    end

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

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

axis([-1 yBmsM 0 par0values(2)])

