Holding plot legend inside loop & between two for loops
1 次查看(过去 30 天)
显示 更早的评论
I am writing legend inside for loop here i am able to hold plot but not the legend
0 个评论
采纳的回答
Sean de Wolski
2012-10-24
I would recommend against this workflow. Insert the legend once at the end. For example:
figure;
hold on;
h =zeros(10,1);
colors = 'rgbcyk';
for ii = 1:numel(h);
h(ii) = plot(1:10,rand(1,10)+sin(rand(1,10)),colors(rem(ii,6)+1));
end
legend(h)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Legend 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!