How do I make a figure legend multiple lines?
古いコメントを表示
The string for my legend is too long to fit into one line. I would like to split it into multiple lines.
採用された回答
その他の回答 (2 件)
Christoforos Kanavakis
2018 年 3 月 23 日
In newer versions, Matlab recommends using 'newline'.
So,
legend({['blue' newline 'line'],'red line'})
This one is a better solution that is easier to implement:
plot(sin(1:.1:10),'r', 'DisplayName', 'Cosine'), hold on
plot(cos(1:.1:10),'g', 'DisplayName', 'Sine')
plot(tan(1:.1:10),'b', 'DisplayName', 'Tangent')
plot(1./tan(1:.1:10),'k', 'DisplayName', 'Inverse Tangent'), grid on
My_LGD = legend;
My_LGD.NumColumns = 2; % Show legends in two lines
カテゴリ
ヘルプ センター および File Exchange で Legend についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
