How to add 'Location' as the name one of the legends in a plot?

3 ビュー (過去 30 日間)
Sai Charan
Sai Charan 2021 年 4 月 18 日
コメント済み: Sai Charan 2021 年 4 月 18 日
Here:
legend('Canada','USA', 'Location', 'bestoutside')
The above code has two countires in legend - Canada and USA
For example,
legend('Canada','Location', 'Location', 'bestoutside')
This does not work? Why?
Can we not name a legend as 'Location'?
If yes, how to?

採用された回答

Jonas
Jonas 2021 年 4 月 18 日
編集済み: Jonas 2021 年 4 月 18 日
no problem using a cell as input for the legend function:
plot(1:3);
hold on;plot(1:4);
legend({'left','location'},'Location', 'bestoutside')
edit: because you asked why it doe not work your way: there are just some keywords when function inputs are processed, if they appear, there often has to be a specific input as following argument

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by