Issues with Legend Creating and Placement
4 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Legend in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!