vLen = [11 11 11 11 11 11 11 20 1 42 42 42 42 42 2 2];
cTyp = {'-*' '-^' '-*' '-^' '-*' '-^' '-v' '-' '^' '-' '-' '-' '-' '-' '-' '-'};
vCol = [5 5 5 5 5 5 2 1 1 5 5 5 3 1 0 0];
vW   = [2 2 2 2 2 2 2 4 2 4 4 4 4 4 1 1];
cLeg = cell(1,16);

tic()

bAfter = true
figure(1)
newplot();
hold all;
legend hide;

for n=1:length(vLen)
  vX = linspace(0,1,vLen(n))';
  vY = rand(vLen(n),1);
  if bAfter
    plot(vX, vY(1:vLen(n)), [cTyp{n} num2str(vCol(n))], 'linewidth', vW(n)/2);
  else
    % dead slow on newer versions, just fine with 3.2.3:
    plot(vX, vY(1:vLen(n)), [cTyp{n} num2str(vCol(n)) ';foo ' num2str(n) ';'], 'linewidth', vW(n)/2);
  end
  cLeg{n} = ['foo ' num2str(n)];
end

toc()
disp("Graph plotted")
tic()
if true
  if bAfter
    profile on
    legend(cLeg, 'location', 'southeastoutside');
    profile off
  else
    legend('location', 'southeast');
  end
  toc()
  disp("Legend command #1 ")
  tic()
  if true
    legend('boxoff');
toc()
  disp("Legend command #2 ")
tic()
    legend('left');  
  end
end
toc()
disp("Legend command #3 ")
tic()
legend show 

axis([-0.1 1.3 -0.1 1.1]);
grid('on');
title('Title');
xlabel('xlabel');
ylabel('ylabel');
hold off
toc()
disp("remaining plot stuff")
T = profile ("info");
profshow(T)



