Issues with Legend Creating and Placement
4 次查看(过去 30 天)
显示 更早的评论
Hi, So I have a group of functions that uses an array of terms n which is listed below, I created a legend using a for loop but I was told that it is easier to do it just in one line, specifically using this one, but whenever I seem to use it, I don't get the legend and my title dissapears, if anyone could point into what im doing wrong, i'd gratly appreciate it. I also wanted to know how to make the legend be placed outside of the frame, I currently use "best" but it still seems to be there. Thanks so much in advance.
n = 0:2:10
for i = 1:6 % Original Loop
lgds{i} = sprintf('Up to n = %i',n(i));
end
% Was told can do in one line with append text to a string using a + sign. Something like this,
'n =' + n;
% Legend
legend(lgds,'FontSize',12, 'Location','best');
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!