Legend in several columns

1,357 ビュー (過去 30 日間)
Auryn_
Auryn_ 2018 年 11 月 30 日
編集済み: nadia naji 2022 年 12 月 18 日
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 件のコメント
Walter Roberson
Walter Roberson 2018 年 12 月 1 日
What difficulty are you observing when you use the File Exchange contribution columnlegend() ?
Auryn_
Auryn_ 2018 年 12 月 2 日
I used 'NumColumns',2 with the normal Legend command and it works.

サインインしてコメントする。

採用された回答

madhan ravi
madhan ravi 2018 年 12 月 1 日
  2 件のコメント
Sebastian Lopez
Sebastian Lopez 2020 年 12 月 5 日
Thanks, that helped!
nadia naji
nadia naji 2022 年 12 月 18 日
編集済み: nadia naji 2022 年 12 月 18 日
I am using Mtalab R2017b, but when I used
legend({'cluster1','cluster2','cluster3','cluster4','cluster5','cluster6'},'NumColumns',2)
it produced this error:Unknown property: NumColumns.
what should I do? we can not legend with multiple columns in older versions?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLegend についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by