There is no way to specify the extent of the box edges in Statistics Toolbox 7.0 (R2008b). The default extents are 25% and 75% percentile.
The extent of 'whiskers' can be specified by using the 'whisker' property for BOXPLOT in terms of the 'whisker' length paramter 'w'. This parameter is typically a factor by which the interquartile distance (distance between the extents of the 25th and 75th percentile marks) is multiplied to get the whisker extent. Currently there is no other way of specifying the whisker extent.
As a workaround, one can get a handle to the line objects that make up the boxplot and change their XData and YData properties appropriately. For example, you can attain the handle to the upper and lower whisker line objects and the upper and lower adjacent value line objects as follows.
samples = rand(100,1);
hAx = axes;
boxplot(samples)
lines = hAx.Children;
uw = findobj(lines, 'tag', 'Upper Whisker');
uav = findobj(lines, 'tag', 'Upper Adjacent Value');
lw = findobj(lines, 'tag', 'Lower Whisker');
lav = findobj(lines, 'tag', 'Lower Adjacent Value');
The whiskers could be modified to, for example, the 5th and 95th percentile values using the "quantile" function.
uw.YData(1,2) = quantile(samples,0.95);
uav.YData(:) = quantile(samples,0.95);
lw.YData(1,1) = quantile(samples,0.05);
lav.YData(:) = quantile(samples,0.05);
Best Answer