Produce a legend in for loop that takes entries from an array
Mostrar comentarios más antiguos
Merry Christmas to all of you. I am trying to incorporate a legend in for loop. my code is the following:
s=['T '; 'Pb '; 'Pf '; 'Pc '; 'Psh '; 'Pito'];
t=cellstr(s);
figure
for k=1:length(pl(end,end,:))
for m=1:length(pl(:,end,end))
subplot(2,3,m) % BUSBAR
semilogx(dim(1,Nmin:Nmax,k)*1000,pl(m,Nmin:Nmax,k),'linewidth',2)
title(t(k))
hold all
end
end
My idea is simple. I want to have a legend that takes values from an array. So if for example I have six curves per plot, I would like to have one legend with 6 entries. I would like something like that because I change very frequently the number of entries and the entries themselves. To give you more details I would like to build a legend with 4 entries and each entry I would like to say 1cm 2cm 3cm 4cm. But I might change that later to 6 different entries.
For that reason I am trying to use a function from the matlab file exchange legend1.m. You can find this in: http://www.mathworks.in/matlabcentral/fileexchange/39505-legend1-m.
I didn't have any success yet. Can you help me please.
Respuesta aceptada
Más respuestas (2)
Giorgos Papakonstantinou
el 25 de Dic. de 2012
Giorgos Papakonstantinou
el 25 de Dic. de 2012
0 votos
Categorías
Más información sobre Legend en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!