function [] = stampa_2(H1,N1,labels,heading,FID)

hndf = figure('OuterPosition',[1600 0 1000 1200],'Name',heading);

nsol = size(H1,3);

subplot(2,2,1);
subplot('Position',[0.03 0.55 0.44 0.41]);
%data_profile_opt(H1,N1,1.d-1,optvalues);
[hl{1},area] = data_profile(H1,N1,1.d-3);
all_area(1,:) = area;
title(['\tau=10^{',int2str(-3),'}']);
%xlabel('Number of simplex gradients, \nu ');
xlabel('Number of parallel simplex gradients, \kappa ');
legend(strread(num2str(area),'%s'),'Location','SouthEast');

subplot(2,2,2);
subplot('Position',[0.52 0.55 0.44 0.41]);
%data_profile_opt(H1,N1,1.d-3,optvalues);
[hl{2},area] = data_profile(H1,N1,1.d-5);
all_area(2,:) = area;
title(['\tau=10^{',int2str(-5),'}']);
%xlabel('Number of simplex gradients, \nu ');
xlabel('Number of parallel simplex gradients, \kappa ');
legend(strread(num2str(area),'%s'),'Location','SouthEast');




subplot(2,2,3);
subplot('Position',[0.03 0.05 0.44 0.41]);
[hl{3},area] = perf_profile(H1,1.d-3,1);
all_area(3,:) = area;
%perf_profile_opt(H1,1.d-3,1,optvalues);
%perf_profile_speedup(H1,1.d-1,0,optvalues,iseq);
title(['\tau=10^{',int2str(-3),'}']);
xlabel('Performance ratio, \alpha ');
legend(strread(num2str(area),'%s'),'Location','SouthEast');


subplot(2,2,4);
subplot('Position',[0.52 0.05 0.44 0.41]);
[hl{4},area] = perf_profile(H1,1.d-5,1);
all_area(4,:) = area;
%perf_profile_opt(H1,1.d-6,1,optvalues);
%perf_profile_speedup(H1,1.d-3,0,optvalues,iseq);
title(['\tau=10^{',int2str(-5),'}']);
xlabel('Performance ratio, \alpha ');
b = strread(num2str(area),'%s');
for s = 1:nsol
    labs{s} = [labels{s} '(' b{s} ')'];
end
legend(labs, 'Location','SouthEast');

%FID = fopen('area_history.tex','a+');
fprintf(FID,'\n%%  %s\n',datestr(now));
fprintf(FID,'%%  (%s) DATA PROFILE $\\tau=10^{-3}, 10^{-5}$   PERF. PROFILE $\\tau=10^{-3}, 10^{-5}$\n',heading);
fprintf(FID,' \\multicolumn{5}{|c|}{%s}\\\\\\hline\n',heading);
fprintf(FID,' & \\multicolumn{2}{|c|}{data profiles} & \\multicolumn{2}{|c|}{perf. profiles}\\\\\\hline\n');
fprintf(FID,' \\multicolumn{1}{|r||}{$\\tau$\\ \\ } & $10^{-3}$ & $10^{-5}$ & $10^{-3}$ & $10^{-5}$\\\\\\hline\n',heading);
% fprintf(FID,'%% ------------------------ area under the curves -----------------------------------\n');
% for i = 1:nsol
%     fprintf(FID,'    %s & ',labels{i});
%     for j = 1:3
%         fprintf(FID,'%15.6e & ',all_area(j,i));
%     end
%     fprintf(FID,'%15.6e ',all_area(4,i));
%     fprintf(FID,'\\\\\\hline\n');
% end
% fprintf(FID,'%% ------------------------ percentages w.r.t. 1st solver ---------------------------\n');
% for i = 1:nsol
%     fprintf(FID,'    %s & ',labels{i});
%     for j = 1:3
%         fprintf(FID,'%7.2f\\%% & ',100*(all_area(j,i)-all_area(j,1))/all_area(j,1));
%     end
%     fprintf(FID,'%7.2f\\%% ',100*(all_area(4,i)-all_area(4,1))/all_area(4,1));
%     fprintf(FID,'\\\\\\hline\n');
% end
fprintf(FID,'%% ------------------------ percentages w.r.t. worst solver -------------------------\n');
minarea = min(all_area,[],2);
temp = zeros(nsol,4);
for i = 1:nsol
    for j = 1:4
        temp(i,j) = round(100*(all_area(j,i)-minarea(j))/minarea(j));
    end
end
[maxtemp,indtemp] = max(temp);
for i = 1:nsol
    fprintf(FID,'    %s & ',labels{i});
    for j = 1:3
       %fprintf(FID,'%7.2f\\%% & ',100*(all_area(j,i)-minarea(j))/minarea(j));
        if(temp(i,j) == maxtemp(j)) & (i == indtemp(j))
            fprintf(FID,'\\bf %7d\\%% & ',round(100*(all_area(j,i)-minarea(j))/minarea(j)));
        else
            fprintf(FID,'     %7d\\%% & ',round(100*(all_area(j,i)-minarea(j))/minarea(j)));
        end
    end
   %fprintf(FID,'%7.2f\\%% ',100*(all_area(4,i)-minarea(4))/minarea(4));
    if(temp(i,4) == maxtemp(4)) & (i == indtemp(4))
        fprintf(FID,'\\bf %7d\\%% ',round(100*(all_area(4,i)-minarea(4))/minarea(4)));
    else
        fprintf(FID,'     %7d\\%% ',round(100*(all_area(4,i)-minarea(4))/minarea(4)));
    end
    fprintf(FID,'\\\\\\hline\n');
end
fprintf(FID,'\\hline\n');
% fprintf(FID,'%% ------------------------ percentages of the largest area -------------------------\n');
% maxarea = max(all_area,[],2);
% for i = 1:nsol
%     fprintf(FID,'    %s & ',labels{i});
%     for j = 1:3
%         fprintf(FID,'%7.2f\\%% & ',100*all_area(j,i)/maxarea(j));
%     end
%     fprintf(FID,'%7.2f\\%% ',100*all_area(4,i)/maxarea(4));
%     fprintf(FID,'\\\\\\hline\n');
% end


%fclose(FID);

for j = 1:3
   %legend(hl{j},strread(num2str(100*(all_area(j,:)-minarea(j))/minarea(j),'%7.2f%%'),'%s'),'Location','SouthEast');
    legend(hl{j},strread(num2str(round(100*(all_area(j,:)-minarea(j))/minarea(j)),'%7d%%'),'%s'),'Location','SouthEast');
end
%b = strread(num2str(100*(all_area(4,:)-minarea(4))/minarea(4),'%7.2f%%'),'%s');
 b = strread(num2str(round(100*(all_area(4,:)-minarea(4))/minarea(4)),'%7d%%'),'%s');
for s = 1:nsol
    labs{s} = [labels{s} '(' b{s} ')'];
end
legend(hl{4},labs, 'Location','SouthEast');


% print (hndf, '-depsc', '-r600','/home/giampo/prova.eps')

end