Navigation

Operators and Keywords

Function List:

C++ API

Function File: s = boxplot (data, notched, symbol, vertical, maxwhisker, …)
Function File: [… h]= boxplot (…)

Produce a box plot.

The box plot is a graphical display that simultaneously describes several important features of a data set, such as center, spread, departure from symmetry, and identification of observations that lie unusually far from the bulk of the data.

data is a matrix with one column for each data set, or data is a cell vector with one cell for each data set.

notched = 1 produces a notched-box plot. Notches represent a robust estimate of the uncertainty about the median.

notched = 0 (default) produces a rectangular box plot.

notched in (0,1) produces a notch of the specified depth. notched values outside (0,1) are amusing if not exactly practical.

symbol sets the symbol for the outlier values, default symbol for points that lie outside 3 times the interquartile range is ’o’, default symbol for points between 1.5 and 3 times the interquartile range is ’+’.

symbol = ’.’ points between 1.5 and 3 times the IQR is marked with ’.’ and points outside 3 times IQR with ’o’.

symbol = [’x’,’*’] points between 1.5 and 3 times the IQR is marked with ’x’ and points outside 3 times IQR with ’*’.

vertical = 0 makes the boxes horizontal, by default vertical = 1.

maxwhisker defines the length of the whiskers as a function of the IQR (default = 1.5). If maxwhisker = 0 then boxplot displays all data values outside the box using the plotting symbol for points that lie outside 3 times the IQR.

Supplemental arguments are concatenated and passed to plot.

The returned matrix s has one column for each data set as follows:

1Minimum
21st quartile
32nd quartile (median)
43rd quartile
5Maximum
6Lower confidence limit for median
7Upper confidence limit for median

The returned structure h has hanldes to the plot elements, allowing customization of the visualization using set/get functions.

Example

 title ("Grade 3 heights");
 axis ([0,3]);
 tics ("x", 1:2, {"girls"; "boys"});
 boxplot ({randn(10,1)*5+140, randn(13,1)*8+135});
 

Demonstration 1

The following code

 axis ([0,3]);
 boxplot ({randn(10,1)*5+140, randn(13,1)*8+135});
 set(gca (), "xtick", [1 2], "xticklabel", {"girls", "boys"})
 title ("Grade 3 heights");

Produces the following figure

Figure 1

Package: statistics