% function makeEpsSet32(filename)
% 
% load(filename);
close all

figure(1)
set(gcf,'paperunits','centimeters','papersize',[21 8],'paperposition',[0 0 21 8]);

%% Histograms
hoffset = .08;
hoffset2 = .02;
hoffset3 = .06;
voffset = .12;
voffset2 = .1;
fw = .22;
fh = .34;

steps = length(interaction{1}((burnIn+1):end));

part1 = (1:14950)+burnIn;
part2 = (14951:29900)+burnIn;

[hits1,bins] = hist(log2(interaction{1}(part1)),0:10); %#ok<*USENS>
[hits2,bins] = hist(log2(interaction{1}(part2)),0:10); %#ok<*USENS>
ymax = max(max(hits1),max(hits2))*1.05;

%%
axes('position',[0+hoffset 0+voffset fw fh]);
[hits1,bins] = hist(log2(interaction{4}(part1)),0:10); %#ok<*USENS>
[hits2,bins] = hist(log2(interaction{4}(part2)),0:10); %#ok<*USENS>

% mu1 = log2(mean(interaction{1}(100:end)));

dw = .45;
h = bar(bins-dw/2,[hits1(:)],1);
hold on
set(h,'facecolor',[.9 .9 .9],'barwidth',dw);
h = bar(bins+dw/2,[hits2(:)],1);
set(h,'facecolor',[.5 .5 .5],'barwidth',dw);
grid on
hold off

title('Random');
xlabel('$K_n$','interpreter','latex');
ylabel('Count');
set(gca,'ylim',[0 ymax],'xlim',[-.5 10.5],'box','on','fontsize',9);
set(gca,'xtick',0:10);
set(gca,'box','off');

%%
axes('position',[fw+hoffset+hoffset2 voffset+fh+voffset2 fw fh]);
[hits1,bins] = hist(log2(interaction{2}(part1)),0:10); %#ok<*USENS>
[hits2,bins] = hist(log2(interaction{2}(part2)),0:10); %#ok<*USENS>

h = bar(bins-dw/2,[hits1(:)],1);
hold on
set(h,'facecolor',[.9 .9 .9],'barwidth',dw);
h = bar(bins+dw/2,[hits2(:)],1);
set(h,'facecolor',[.5 .5 .5],'barwidth',dw);
grid on
hold off

title('Simple');
set(gca,'ylim',[0 ymax],'yticklabel',{},'xlim',[-.5 10.5],'fontsize',9);
set(gca,'box','off');
set(gca,'xticklabel',{});
set(gca,'xtick',0:10);

%%
axes('position',[0+hoffset voffset+fh+voffset2 fw fh]);
[hits1,bins] = hist(log2(interaction{1}(part1)),0:10); %#ok<*USENS>
[hits2,bins] = hist(log2(interaction{1}(part2)),0:10); %#ok<*USENS>

h = bar(bins-dw/2,[hits1(:)],1);
hold on
set(h,'facecolor',[.9 .9 .9],'barwidth',dw);
h = bar(bins+dw/2,[hits2(:)],1);
set(h,'facecolor',[.5 .5 .5],'barwidth',dw);
grid on
hold off

title('ARPF');
ylabel('Count');
set(gca,'ylim',[0 ymax],'xlim',[-.5 10.5],'box','on','fontsize',9);
set(gca,'box','off');
set(gca,'xticklabel',{});
set(gca,'xtick',0:10);

%%
axes('position',[fw+hoffset+hoffset2 voffset fw fh]);
[hits1,bins] = hist(log2(interaction{3}(part1)),0:10); %#ok<*USENS>
[hits2,bins] = hist(log2(interaction{3}(part2)),0:10); %#ok<*USENS>

h = bar(bins-dw/2,[hits1(:)],1);
hold on
set(h,'facecolor',[.9 .9 .9],'barwidth',dw);
h = bar(bins+dw/2,[hits2(:)],1);
set(h,'facecolor',[.5 .5 .5],'barwidth',dw);
grid on
hold off

title('Greedy');
xlabel('$K_n$','interpreter','latex');
set(gca,'ylim',[0 ymax],'yticklabel',{},'xlim',[-.5 10.5],'fontsize',9);
set(gca,'box','off');
set(gca,'xtick',0:10);

%% ESS Curves
axes('position',[hoffset+fw*2+hoffset2+hoffset3 voffset .37 2*fh+voffset2]);
lh = line(0:(size(ESSC{2},1)-1),mean(ESSC{2},2)); %#ok<*USENS>
set(lh,'linestyle','-','color','k','marker','x','markersize',4);
lh = line(0:(size(ESSC{2},1)-1),mean(ESSC{3},2)); %#ok<*USENS>
set(lh,'linestyle','--','color','k','marker','x','markersize',4);
lh = line(0:(size(ESSC{4},1)-1),mean(ESSC{4},2)); %#ok<*USENS>
set(lh,'linestyle','-.','color','k','marker','x','markersize',4);

set(gca,'fontsize',9,'box','off');
set(gca,'ytick',.5:.1:1);
xlabel('$k$','interpreter','latex');
ylabel('$\mathcal{E}$','interpreter','latex');
%%
set(gcf,'windowStyle','docked');
print -depsc -loose figure32

