% subroutine to plot the size distribution where we select start and
% endtime of the event
disp('plotting data');
figure(1);clf;
set(gcf,'paperorientation','portrait');
set(gcf,'paperunits','centimeters');
set(gcf,'papertype','a4letter');
set(gcf,'paperposition',[0 0 20.984 29.677]);
fontsize=14;
hold;
colormap(jet(250));
set(gca,'position',[0.1 0.1 0.72 0.8]);
yaxis=[3 4 5 6 7 8 9 10 20 30 40 50 60 70 80 90 100 200 300 400 500 ...
      600 700 800 900 1000]*1e-9;
set(gca,'ylim',[yaxis(1) yaxis(length(yaxis))])
set(gca,'ytick',[yaxis],'yticklabel',{[],[],[],[],[],[],[], ...
      [10],[],[],[],[],[],[],[],[], ...
      [100],[],[],[],[],[],[],[],[],[1000]})
xti=period(i)+[-.25 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 24.25]/24;
set(gca,'yticklabelmode','manual')
set(gca,'xlim',[xti(1) xti(length(xti))])
set(gca,'xtick',xti,'xticklabel',{[],[],[],[],[],[],[],[],[],[], ...
      [],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]})
set(gca,'fontsize',14);
set(gca,'yscale','log');
baraxis=[1 2 3 4 5];
caxis([baraxis(1) baraxis(length(baraxis))]);
text(period(i)+.35,400e-9,datestr(period(i)),'fontsize',fontsize,'color','white');
text(period(i)+1.1,800e-9,'cm^{-3}','fontsize',fontsize);
h=colorbar('vertical');
set(h,'fontsize',14)
set(h,'position',[0.85 0.2 .03 .6])
set(h,'ylim',[baraxis(1) baraxis(length(baraxis))],'ytick',[baraxis])
set(h,'yticklabel',{'10';'100';'1000';'10000';'100000'})

if exist([stationname,datestr(period(i),'YY'),datestr(period(i),'mm'),datestr(period(i),'dd'),'.sum'])>0;
dmpsselect1=dmpsdata(find(dmpsdata(:,1)==i),4:end);
time1=dmpsdata(find(dmpsdata(:,1)==i),2);
% correcting data if below 0
for j=1:size(dmpsselect1,1)
    for k=1:size(dmpsselect1,2)
        if dmpsselect1(j,k)<=0
            dmpsselect1(j,k)=1e-14;
        end
    end
end
%% taking log (to be able to plot correctly)
dmpsselect1=log10(dmpsselect1);
%% plotting spectra
pcolor(time1,sizes,dmpsselect1')
shading interp
end
if exist([stationname,datestr(period(i),'YY'),datestr(period(i),'mm'),datestr(period(i),'dd'),'.fit'])>0;
dmpsfit1=dmpsfitdata(find(floor(dmpsdata(:,1))==period(i)),3:end);
end
hold off;

