Whiskers in Boxplot seems incorrect
Show older comments
I am having a problem with getting the whiskers in the boxplot correct. I have cooked my code down to the below. I compute the upper whisker value to 99.54, but the boxplot show this as around 50.
%Example BoxPlot
x=[126.0 32.2 19.4 0.02 -1.4 272.75 26.0 -0.01 3.66 40.86 16.7 1.8 ...
16.0 462.1 13.2 45.4 23.0 166.4 11.9 14.96 14.20 30.20 1.7 0.9 0.2];
q75_test=quantile(x,0.75);
q25_test=quantile(x,0.25);
w=2.0;
wUpper=w*(q75_test-q25_test)+q75_test;
boxplot(x,'whisker',w);
line([0 7],[wUpper wUpper]);

Accepted Answer
More Answers (1)
I'm certain a lot of people would appreciate functionality which would extend the whisker to the statistical definition, not nearest adjacent. I'm heading through the in-built function to see if I can manage it, learning a lot, it's an impressive bit of code for me.
All the best
J Duell
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!