Statistics - Maple Programming Help

Home : Support : Online Help : Graphics : Statistics : Statistics/BoxPlot

Statistics

 BoxPlot
 create box plots from data

 Calling Sequence BoxPlot(X, options, plotoptions) BoxPlot['interactive'](X)

Parameters

 X - data options - (optional) equation(s) of the form option=value where option is one of datasetlabels, color, deciles, distance, mean, notched, offset, orientation, outliers, or width; specify options for generating the box plot plotoptions - options to be passed to the plots[display] command

Description

 • The BoxPlot command generates a box plot for the specified data.
 • The first parameter X is either a single data sample - given as e.g. a Vector - or a list of data samples. Note that the individual samples may be of variable size.
 • If the ['interactive'] option is used, then a dialog box appears that allows for customized creation of the plot.

Options

 The options argument can contain one or more of the options shown below. All unrecognized options will be passed to the plots[display] command. See plot/options for details.
 • datasetlabels=default or list
 Data set labels for the individual boxes. The labels appear along the axes.  By default, the labels are set to 1, 2, 3, etc.
 • color=name, list, or range
 This option specifies colors for the individual data sets. When a list of colors is given, each of the boxes is colored with the corresponding color in the list. If a range of colors is given, the colors are generated by selecting an appropriate number of equally spaced points in the corresponding hue range.
 • deciles=truefalse
 If this option is set to true then the deciles are included in the plot. Deciles are represented by points with symbol type set to box. The default value is true.
 • offset=realcons
 Initial offset along the x-axis. The default value is 0.
 Note: By default, the view wraps tightly around all visible plot objects and the horizontal axis is marked by data set labels, not regular coordinates, so this option will have no (visual) effect. It is meant for the case where this plot is combined with other plot elements.
 • distance=nonnegative
 This option controls the distance between the boxes. The default value is 0.25.
 • width=realcons
 This option controls the width of the boxes. The default value is 0.75.
 The following plot illustrates how the options offset, distance, and width are interpreted.
 – Note the lengths of the arrows labeled "offset", "width", and "distance" correspond to values for the offset, width, and distance options respectively.
 • mean=true or false
 If this option is set to true then the mean is included in the plot. The default value is true.
 • notched=true or false
 Draws notches on box-and-whisker plots. The default is false.
 • orientation=horizontal or vertical
 Indicate the orientation of the box plots. The default is vertical.
 • outliers=true or false
 Outliers are points that are farther than 3/2 times the interquartile range away from the upper and lower quartiles. If this option is set to false, then the outlying points are not included in the plot. In this case, the whiskers are extended past outliers to the maximum and minimum points.

Notes

 • Note that the labels for the data sets are placed on the axes, and should not be confused for coordinates.

Examples

 > $\mathrm{with}\left(\mathrm{Statistics}\right):$
 > $A≔\left[\mathrm{seq}\left(\mathrm{Sample}\left(\mathrm{Normal}\left(\mathrm{ln}\left(i\right),3\right),100\right),i=1..20\right)\right]:$
 > $\mathrm{BoxPlot}\left(A,\mathrm{title}="Box Plot",\mathrm{deciles}=\mathrm{false}\right)$

The commands to create the plot from the Plotting Guide are

 > $A≔\left[\mathrm{seq}\left(\mathrm{Sample}\left(\mathrm{Normal}\left(\mathrm{ln}\left(i\right),3\right),10\right),i=1..3\right)\right]:$
 > $\mathrm{BoxPlot}\left(A,\mathrm{color}=\left["Niagara Green","Niagara Red","Niagara Blue"\right],\mathrm{deciles}=\mathrm{false}\right)$

The BoxPlot command also accepts a Matrix. The columns are understood as individual data samples.

 > $M≔{\mathrm{Matrix}\left(A,\mathrm{scan}=\mathrm{columns}\right)}^{\mathrm{%T}}$
 ${M}{≔}\left[\begin{array}{ccc}{-6.15026459336058}& {3.92371013101162}& {4.18656682418225}\\ {-4.75323429938184}& {-2.37726783252569}& {1.80091744993437}\\ {0.437678454613428}& {3.85224337559343}& {-2.14973018520115}\\ {2.30262290447149}& {3.37829880614974}& {3.56948759515931}\\ {3.98256142065323}& {7.66312008588142}& {-3.07100377513460}\\ {-1.16195228843286}& {-1.17658650278167}& {-2.68832699450844}\\ {-0.801278731828643}& {1.40148133239068}& {3.78537967747607}\\ {-0.896338423031310}& {4.69554717110909}& {1.06825911132501}\\ {5.48507960338911}& {1.74466378733016}& {3.37507641016678}\\ {1.06042255049519}& {0.0600928337961485}& {3.55227242615577}\end{array}\right]$ (1)

Plot options such as title are passed to the plots:-display command:

 > $\mathrm{BoxPlot}\left(M,\mathrm{color}="Niagara Green",\mathrm{deciles}=\mathrm{false},\mathrm{title}="Box Plots"\right)$

Compatibility

 • The Statistics[BoxPlot] command was updated in Maple 2017.
 • The offset option was updated in Maple 2017.