| Contents | Index |
plot::Boxplot(data) creates a box plot of the given data.
Calls:
plot::Boxplot(L1, ..., <a = amin .. amax>, Options)
plot::Boxplot([L1, ...], <a = amin .. amax>, Options)
plot::Boxplot(A, <a = amin .. amax>, Options)
plot::Boxplot(s, <c1, ...>, <a = amin .. amax>, Options)
plot::Boxplot(s, <[c1, ...]>, <a = amin .. amax>, Options)
Parameters:
|
L1, ...: |
data samples: lists of numerical real values or arithmetical expressions of the animation parameter a. |
|
A: |
an array of domain type DOM_ARRAY or a matrix of category Cat::Matrix (e.g., of type matrix or densematrix) providing numerical real values or arithmetical expressions of the animation parameter a. The columns are regarded as separate data samples. Also a 1-dimensional array, regarded as a single data sample, is accepted. |
|
s: |
a data collection of domain type stats::sample. The columns in s are regarded as separate data samples. |
|
c1, ...: |
column indices into s: positive integers. These indices, if given, indicate that only the specified columns in s should be used as data samples. If no column indices are specified, all columns in s are used as data samples. |
Related Domains:
plot::Bars2d, plot::Bars3d, plot::Histogram2d, plot::Scatterplot
Related Functions:
Details:
plot::Boxplot creates a box plot of discrete data samples. Box plots reduce data samples to a number of descriptive parameters and are a useful means of comparing statistical data.
In particular, each data sample is represented as one box. A typical box consists of the following subparts:
|
|
A “central box” representing the central 50% of the data. Its lower and upper boundary lines are at the 25%/75% quantile of the data. A central line indicates the median of the data.
Two vertical lines extending from the central box indicating the remaining data outside the central box that are not regarded as outliers. These lines extend maximally to
times the height of the central box but not past the range of the data.
Outliers: these are points indicating the remaining data.
With the special attribute Notched = TRUE, the sides of the boxes can be notched, thus providing additional information on the data sample. The horizontal width of the notches may be set by the attribute NotchWidth.
The special attributes BoxCenters and BoxWidths allow to center the boxes at arbitrary positions along the horizontal axis and to set the horizontal width of the boxes, respectively.
The special attribute Averaged determines whether the quantile values are computed with or without the option Averaged (cf. stats::empiricalQuantile).
Specifying DrawMode = Horizontal, the boxes are rotated by 90 degrees.
The attribute Colors allows to specify the color of each box in a box plot. A common color for all boxes may be specified via Color.
Example 1
Just to show basic usage of plot::Boxplot, we plot some data samples chosen arbitrarily:
data1 := [5, 10, 24, -4, 13]:
data2 := [7, 9, -1, 4, 10, 8, 12, 10, 15]:
b := plot::Boxplot(data1, data2):
plot(b)

We can modify the appearance of the box plot in various ways:
b::Notched := TRUE:
b::Colors := [RGB::Green, RGB::Black]:
b::BoxCenters := [2, 3]:
b::FillPattern := XCrossedLines:
plot(b)

delete b:
Example 2
It is possible to shift the whole plot in
-direction by providing a center for the first box via BoxCenters:
A := matrix([[ 5, 6, 19],
[10, 5, 45],
[24, 2, 12],
[-3, 18, -10],
[-4, 0, - 4]]):
plot(plot::Boxplot(A, BoxCenters = [2], Notched = TRUE,
FillPattern = Solid))

delete A:
Example 3
The primary use of plot::Boxplot is comparing data sets. We shall do this for data produced by the following random number generators:
f := stats::normalRandom(1, 0.2):
g := stats::uniformRandom(0, 2):
Now, we create small samples and compare their boxes:
data1 := [f() $ k = 1..100]: // Red
data2 := [f() $ k = 1..100]: // Green
data3 := [g() $ k = 1..100]: // Blue
plot(plot::Boxplot(data1, data2, data1, data3, data2, data3,
Colors = [RGB::Red, RGB::Green, RGB::Red, RGB::Blue,
RGB::Green, RGB::Blue],
BoxCenters = [1, 2, 4, 5, 7, 8], Notched = TRUE))

Comparing the central boxes, the blue data differ significantly from the red and the green data. The red and green boxes, however, are quite similar – as they should, given that the red and green data were produced by the same random generator f.
delete f, g, data1, data2, data3:
Example 4
For symmetric input data, the images generated by plot::Boxplot are symmetric, too:
plot(plot::Boxplot([$0..10], [5+5*sin(PI*n/20) $ n=-10..10], Notched))

Example 5
By default, the quantile lines of the boxes are computed with the option Averaged (see stats::empiricalQuantile for details). When using Averaged = FALSE, the quantiles are computed without this option:
r := random(0..10):
SEED := 123:
data := [r() $ k = 1..250]:
plot(plot::Boxplot(data, Averaged = TRUE, BoxCenters = 0.5, Color = RGB::Blue, Notched),
plot::Boxplot(data, Averaged = FALSE, BoxCenters = 1.5, Color = RGB::Red, Notched)
):

delete r, SEED, data:
Example 6
Box plots can be animated. We create two data samples and fuse them to a symbolic superposition:
f1 := stats::normalRandom(0, 1):
f2 := stats::normalRandom(4, 8):
data0 := sort([f1() $ k = 1..100]):
data1 := sort([f2() $ k = 1..100]):
data01 := [(1 - a)*data0[i] + a*data1[i] $ i = 1..100]:
The box associated with the data sample data01 changes from the box associated with data0 to the box associated with data1 as the animation parameter increases from
to
:
plot(plot::Boxplot(data0, data01, data1, a = 0..1))


delete f1, f2, data0, data1, data01:

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |