フィルターのクリア

How to create line breaks in x-axis tick labels of a boxplot in MATLAB?

64 ビュー (過去 30 日間)
weijie.zhu
weijie.zhu 2023 年 11 月 30 日
コメント済み: weijie.zhu 2023 年 11 月 30 日
boxplot(rand(10,11))
ax=gca;
ax.Title.String='Points Scored by the Top 11 Scoring NBA Players in 2012';
ax.Subtitle.String='Each point is a game';
ax.XLim=[0,12];
ax.XTick=1:1:11;
ax.XTickLabel = {'Lebron\newlineJames', 'Deron\newlineWilliams', 'James\newlineHarden', ...
'Carmelo\newlineAnthony', 'Tony\newlineParker', 'Kyrie\newlineIrving', ...
'Stephen\newlineCurry', 'Russell\newlineWestbrook','Lamarcus\newlineAldridge','Kevin\newlineDurant','Kobe\newlineBryant'};
  1 件のコメント
weijie.zhu
weijie.zhu 2023 年 11 月 30 日
編集済み: weijie.zhu 2023 年 11 月 30 日
ax=gca;
ax.Title.String='Points Scored by the Top 11 Scoring NBA Players in 2012';
ax.Subtitle.String='Each point is a game';
ax.XLim=[0,12];
ax.XTick=1:1:11;
ax.XTickLabel = {'Lebron\newlineJames', 'Deron\newlineWilliams', 'James\newlineHarden', ...
'Carmelo\newlineAnthony', 'Tony\newlineParker', 'Kyrie\newlineIrving', ...
'Stephen\newlineCurry', 'Russell\newlineWestbrook','Lamarcus\newlineAldridge','Kevin\newlineDurant','Kobe\newlineBryant'};

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

採用された回答

Dyuman Joshi
Dyuman Joshi 2023 年 11 月 30 日
編集済み: Dyuman Joshi 2023 年 11 月 30 日
Change the TickLabelInterpreter to 'tex'.
You can adjust the x-axis fontsize to avoid the overlapping among labels.
boxplot(rand(10,11))
ax=gca;
ax.Title.String='Points Scored by the Top 11 Scoring NBA Players in 2012';
ax.Subtitle.String='Each point is a game';
ax.XLim=[0,12];
ax.XTick=1:1:11;
ax.XTickLabel = {'Lebron\newlineJames', 'Deron\newlineWilliams', 'James\newlineHarden', ...
'Carmelo\newlineAnthony', 'Tony\newlineParker', 'Kyrie\newlineIrving', ...
'Stephen\newlineCurry', 'Russell\newlineWestbrook','Lamarcus\newlineAldridge','Kevin\newlineDurant','Kobe\newlineBryant'};
%Change the Tick label interpreter
ax.TickLabelInterpreter = 'tex';
%Adjust the x-axis font size
ax.XAxis.FontSize = 7;

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by