How do I place a two-lined title, x-label, y-label, or z-label on my plot?
765 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2013 年 5 月 8 日
編集済み: MathWorks Support Team
2017 年 6 月 12 日
I would like to create a multi-lined title, x-label, y-label or z-label. I would like to know if there are any functions in MATLAB that allow me to create a title that uses multiple lines.
採用された回答
MathWorks Support Team
2017 年 6 月 12 日
編集済み: MathWorks Support Team
2017 年 6 月 12 日
You can create multi-line text using a cell array. For example, this code creates a title and an axis label with two lines.
plot(1:10)
title({'First line';'Second line'})
xlabel({'First line';'Second line'})
For more information about creating multiline text, see
0 件のコメント
その他の回答 (1 件)
Karan Gill
2016 年 10 月 31 日
Replace spaces with "\newline".
labels = {'line1 line2','line1 line2','line1 line2'};
labels = cellfun(@(x) strrep(x,' ','\newline'), labels,'UniformOutput',false);
a = gca;
a.XTickLabel = labels;
Karan | Symbolic Math documentation
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Labels and Annotations についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!