function graphEpochs(jobdir, savePrefix)

%%% Fetch data
filesEpochs = dir(fullfile(jobdir,'*.epochs'));
n = length(filesEpochs);
columns = floor(sqrt(n));
rows = n / columns;
if ( mod( n, columns ) )
  error('Number of *.epochs files cannot be decomposed');
end

set(0,'DefaultAxesColorOrder',mycolororder);

for p = 0:n-1
  pattern = sprintf('*.p%02g.epochs',p);
  file = dir(fullfile(jobdir,pattern));
  if ( length(file) ~= 1)
    error([ 'There can be only one file matching pattern ' pattern ]);
  end
  file = fullfile(jobdir, file.name);
  data = importdata(file,'\t',0);
  x = data(:,1);
  e = data(:,2);
  t = data(:,3);
  c = data(:,4);
  cString = 'c';

  rho = 1 ./ ( 2 + ( ((n-2)/n).*c ) + ( sqrt(t)./n ) );

  genes = getNumGenes(savePrefix);
  if (genes)
    c = c .* (100 / genes);
    cString = 'c [%]';
  else
  end

  subplot(rows,columns,p+1);

  plot(x,e, x,c, x,rho*100, 'LineWidth',1.0);
  grid on;
  if (p==0)
    YL = ylim;
    ylim([YL(1) YL(2)*1.2]);
    legend( {'e',cString,'\rho [%]'}, 'Orientation','Horizontal', 'Location','North' );
  end
  xlabel( 'No. of generations' );
  title( [ 'Processor P' num2str(p,'%02g') ] );
end


saveas(gcf, [savePrefix '.epochs' '.eps'], 'psc2' );
saveas(gcf, [savePrefix '.epochs' '.fig'] );
saveas(gcf, [savePrefix '.epochs' '.png'] );

%close
end
