function plotmultimean(X, Y,leglab, fignum);

%plots multiple plots over their time scale and the mean 


% X=comptime;
% Y=squeeze(compT(:,le,:));
% leglab=['45';'46';'47';'48';'49'];
% fignum=3;
[a,b]=size(X);
if a == 1 | b == 1
    for n=1:1:length(Y(:,1))
        X(n,:)=X(1,:);     %makes the X row vector repeat if it is only entered once
    end
end
    

%plots multiple rows of data in a nice format
figure(fignum); clf;

sty=['  r';'  b';'  g';'  k'; '  c'; '  m'; 'r--'; 'b--'; 'g--'; 'k--'; 'c--';'m--'];
sty=[sty;sty;sty;sty;sty;sty;sty];
sty=[sty;sty;sty;sty;sty;sty;sty];

for n=1:1:length(X(:,1))
    hold on;
    plot(X(n,:), Y(n,:), char(sty(n,1:3)))
end

legend(leglab)  %sty(1:length(X(:,1)), 1:3),

hold on

plot(X(1,:), mean(Y), 'LineWidth',3);
%legend(['MEAN';leglab])