How could I change the axis for a boxplot that is automatically produced from ANOVA test?

9 次查看(过去 30 天)
How could I change the axis on my boxplot? I did a ANOVA test and a box-plot was automatically produced. I have 3 groups for my analysis. By default, the group was labelled as 1, 2, 3 accordingly. I would like to change it to A, B, C.
I have tried to do something like this (see below), but it did not work.
boxplot([x1,x2],'Notch','on','Labels',{'A','B','C'})

采纳的回答

Ive J
Ive J 2020-12-20
You can set XTickLabel property of the generated boxplot.
mydata = randn(20, 3);
anova1(mydata);
set(gca, 'XTickLabel', {'A', 'B', 'C'}) % the last gca is the boxplot by default.
Alternatively, use group argument of anova1:
mydata = rand(1, 60);
group = repmat({'A', 'B', 'C'}, 1, 20);
anova1(mydata, group)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Analysis of Variance and Covariance 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by