function visualiseSingleRun(X,MU,ESS,NSTRATA,settings)

x = settings.x;
y = settings.y;
nStep = settings.nStep;
essThreshold = settings.essThreshold;
method = settings.method;
nLag = settings.nLag;
N = settings.N;

close all

figure
hold on
plot(1:nStep,x,'k-');
plot(1:nStep,y,'rx');
hold off
set(gcf,'windowStyle','docked');
title(['Samples and signal (' method ')'])
xlabel('time');
ylabel('State space');

% Create histogram
Ngd = 150;
histLim = 3;
gd = linspace(-histLim,histLim,Ngd);
H = zeros(Ngd,nStep);
for i = 1:nStep
    htmp = hist(X(:,i,end-1),gd);
    H(:,i) = htmp(:) / sum(htmp);
end

figure
imagesc(1:nStep,gd,H);
set(gca,'ydir','normal');
hold on
plot(1:nStep,x,'k-');
plot(1:nStep,y,'g-');
lagLineStyles = {'m-','m--','m:','m.-'};
markerStyles = {'.','o','x','^'};
nSty = length(lagLineStyles);
for i = 1:nLag
    plot((1:nStep)-i+2,MU{1}(i,:),lagLineStyles{mod(nSty + i - 1,nSty)+1},...
        'marker',markerStyles{mod(nSty + i - 1,nSty)+1});
end
set(gcf,'windowStyle','docked');
title(['Histogram and signal (' method ')'])
xlabel('time');
ylabel('State space');

figure
plot(1:nStep,ESS,'.-'); hold on
plot([1 nStep],essThreshold*ones(1,2),'r--'); hold off
set(gca,'ylim',[0 1.1]);
set(gcf,'windowStyle','docked');
title(['ESS (' method ')'])
xlabel('time');
ylabel('ESS');

figure
stem(1:nStep,(N-NSTRATA)/N,'.')
set(gcf,'windowStyle','docked');
title(['Interaction (' method ')'])
xlabel('time');
ylabel('# blocks');
end
