Statistics Toolbox    
boxplot

Box plots of a data sample

Syntax

Description

boxplot(X) produces a box and whisker plot for each column of X. The box has lines at the lower quartile, median, and upper quartile values. The whiskers are lines extending from each end of the box to show the extent of the rest of the data. Outliers are data with values beyond the ends of the whiskers. If there is no data outside the whisker, a dot is placed at the bottom whisker.

boxplot(X,notch) with notch = 1 produces a notched-box plot. Notches graph a robust estimate of the uncertainty about the means for box-to-box comparison. The default, notch = 0, produces a rectangular box plot.

boxplot(X,notch,'sym') where sym is a plotting symbol, affords control of the symbol for outliers. The default is  '+'. See the MATLAB LineSpec property for information about the available marker symbols.

boxplot(X,notch,'sym',vert) with vert = 0 creates horizontal boxes rather than the default vertical boxes (vert = 1).

boxplot(X,notch,'sym',vert,whis) enables you to specify the length of the "whiskers." whis defines the maximum length of the whiskers as a function of the inter-quartile range (default = 1.5). Each whisker extends to the most extreme data value within whis * IQR of the box. boxplot displays all data values beyond the whiskers using the plotting symbol, 'sym'. To display all data values outside the box using 'sym', set whis = 0.

Examples

This example produces box plots for the sample data, and accepts the default 1.5 * IQR for the length of the whiskers.

The difference between the means of the two columns of x is 1. We can detect this difference graphically by observing that the notches in the boxplot do not overlap.

The following figure shows the boxplot for same data with the length of the whiskers specified as 1.0. Points beyond the whiskers are displayed using 'o'.

See Also

anova1, kruskalwallis


  bootstrp candexch