how to change the box width in boxplot?
Show older comments
Hi
I wanted to have a boxplot for a poster with different datasets which are divided in different clusters. Now the code works fine, but the boxes are too small for the poster. I tried different things but did not succeed. Could anyone help me please? I'm so lost.
This is the coresponding code:
cluster1 = [1,127; 1,187; 2,144; 2,205; 3,155; 3,229];
cluster2 = [1,66; 1,127; 2,81; 2,144; 3,79; 3,155];
cluster3 = [1,0; 1,66 ;2,0; 2,81; 3,0; 3,79];
boxplot(cluster3(:,2),cluster3(:,1),'PlotStyle','compact','colors', 'r');
hold on
boxplot(cluster2(:,2),cluster2(:,1),'PlotStyle','compact','colors', 'g');
hold on
boxplot(cluster1(:,2),cluster1(:,1),'PlotStyle','compact','colors', 'b');
Thanks a lot!
Answers (1)
the cyclist
on 8 Jan 2020
0 votes
You chose the "compact" plot style. Do you prefer this version, which is the default (non-compact)?

Also, are you sure you are plotting how you want, to best show your data? First, your cluster3 doesn't show up at all. Second, a box plot is not very appropriate when you just have two data points in each cluster.
Categories
Find more on Box Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!