1. Use the 'plot' handles.
x1 = 1:10;
y1blue = 2 .* x1;
y2green = 2 .* y1;
y3red = y2 + 5;
h1 = plot(x1,y1blue ,'b');
hold on;
h2 = plot(y2green,'g');
h3 = plot(y3red,'r');
%Legend all the line plots
legend('Y1blue','Y2green', 'Y3red');
%Legend only Y1 and Y2
legend([h1 h2],{'Y1','Y2'});
2. Another method to control the 'legend content' is given HERE
3. How to use numbers in the legend?
legend({['PRN' num2str(1)],['PRN' num2str(2)]});
x1 = 1:10;
y1blue = 2 .* x1;
y2green = 2 .* y1;
y3red = y2 + 5;
h1 = plot(x1,y1blue ,'b');
hold on;
h2 = plot(y2green,'g');
h3 = plot(y3red,'r');
%Legend all the line plots
legend('Y1blue','Y2green', 'Y3red');
%Legend only Y1 and Y2
legend([h1 h2],{'Y1','Y2'});
2. Another method to control the 'legend content' is given HERE
3. How to use numbers in the legend?
legend({['PRN' num2str(1)],['PRN' num2str(2)]});
No comments:
Post a Comment