function ADTestMag_Plot(M,mmin,P,EPS,MTdistribution)

clf
EPS2=0.1;
xa=min(M):EPS2:max(M);xa1=[min(mmin) max(mmin)];

subplot(2,1,1);plot(mmin,P,'ro-','MarkerSize',12,'LineWidth',1,'MarkerFaceColor',[0.33 0.66 0.99]);
hold on;plot([min(M)-EPS max(M)],[0.05 0.05],'k--','Linewidth',2);xlim([min(M)-EPS max(M)]);
ylabel('p-value','FontSize',16);legend('p-value','0.05 line','Location','best');
if strcmp(MTdistribution,'exp');title('AD Test for Exponential Distribution','FontSize',16)
elseif strcmp(MTdistribution,'weibul');title('AD Test for Weibull Distribution','FontSize',16)
end
subplot(2,1,2);histogram(M,numel(xa),'FaceColor',[0.7 0.7 0.8]);set(gca,'YScale','log');hold on
xlim([min(M)-EPS max(M)]);xlabel('Data','FontSize',16);ylabel('N','FontSize',16);
title('Event Counts','FontSize',16)

cd Outputs_ADTestMag\;saveas(gcf,'ADTestMag_output.jpg');cd ../

end



