Boxplot Label Numberical Organization
2 views (last 30 days)
Show older comments
Aaditya Pore
on 11 Jul 2022
Answered: Aaditya Pore
on 12 Jul 2022
I am trying to graph multiple boxplots on a figure that have varying x values. I am inserting these labels into the boxplot function like so:
b = boxplot(ErrorPlot, 'Labels', weight);
However, I face an issue when the labels vary in distance. When graphing a set of labels, like seen in the image, the boxplots are equidistant regardless of what their labels say. Is it possible to ensure that these boxplots are graphed with a distance matching their label value (i.e. 10 and 20 are only 1/10th as far from each other as 100 and 200 are)?
0 Comments
Accepted Answer
More Answers (1)
dpb
on 11 Jul 2022
Not an option w/ builtin boxplot, sorry.
You can make it work with the alternate boxchart function, but the large scale factor will probably end up with the boxes only being vertical lines as the spacing between the axis values is almost all white space.
I tried
x=randi(20,[20,4]);
g=[10 20 100 200].*ones(size(x));
hBC=boxchart(g(:),x(:));
with just a subset of your x values above -- it was less than satisfactory, methinks --
There is not an optional input to let one set the width of the boxes independently; whether one could go "handle-diving" and uncover the pieces and modify them or not I didn't explore.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!