How could I change the axis for a boxplot that is automatically produced from ANOVA test?
4 views (last 30 days)
Show older comments
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'})
1 Comment
Olisa Ezeh
on 20 Dec 2020
put a screen shot of your code workspace with all the syntaxes and variables
Accepted Answer
Ive J
on 20 Dec 2020
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 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!