Legend in several columns

1.688 views (last 30 days)
Auryn_
Auryn_ on 30 Nov 2018
Commented: Sebastian Lopez on 5 Dec 2020
Hi,
Every time I wanted to split my legend into more than one column I always used the function "columnlegend".
Now i am creating plots with a loop, as below:
legendLables=[];
for iM=1:length(Mvec)
plot(Xvec,F(iM,:), '*-', 'LineWidth',3,'Markersize',3); hold all
legendLables=[legendLables,{['$M=' num2str(Mvec(iM)) '$']}];
end
In this case the function columnlegend does not work, when I use:
columnlegend(6,legendLables,'NorthWest');
or
columnlegend(6,legendLables{:},'NorthWest');
Coudl you please help me?
Thanks in advance!
  3 Comments
Auryn_
Auryn_ on 2 Dec 2018
I used 'NumColumns',2 with the normal Legend command and it works.

Sign in to comment.

Accepted Answer

madhan ravi
madhan ravi on 1 Dec 2018

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by