How to change x-axis with boxplot

I have boxplot like this
X = randn(100,82);
boxplot(X)
How to change the x-axis to only show the indices 20,40,60, and 80.
This code is not working
set(gca,'XTick',(20:20:80));

 採用された回答

Voss
Voss 2022 年 6 月 26 日

0 投票

Like this?
X = randn(100,82);
boxplot(X)
xt = 20:20:80;
set(gca,'XTick',xt,'XTickLabel',xt);
Or like this?
xt = 20:20:80;
boxplot(X(:,xt))
set(gca,'XTickLabel',xt);

その他の回答 (0 件)

質問済み:

NA
2022 年 6 月 26 日

回答済み:

2022 年 6 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by