Skip to main content

Boxplot

Boxplots are very useful for a concise representation of a data set. In one boxplot, we see the median, the interquartile range (IQR), as well as outliers.

Syntax

boxplot(Statistics_data)

Description

It draws a boxplot for a data sample.

graphics.boxplot.calc.png
graphics.boxplot.plotter.calc.png

Options

Option

Description

Format

Default value

box_width

Specifies the width of all boxes.

Positive Float.

1

color

Specifies the color of the outline of all boxes.

RGB list of values {r,g,b} where r, g, and b are integers between 0-255. Alternatively one of the following strings: black, white, red, green, blue, cyan, magenta, yellow, brown, orange, pink, grey, dark_grey, light_grey, or one of the HTML colors, by name (e.g. html_indigo rather than 4b0082).

{255,128,0}

data_subset

A list specifying which positions (indexing begins at 1) of the list of values in data are to be used for the boxplot.

List of positive integers.

{} (empty list, all values are taken)

fill

When set to true, fill_color can be used to color the interior of the bars. If false, the fill_color option is ignored.

Boolean.

false

fill_color

Set the color to be used in the interior of all boxes (if fill is true).

Color value following the format described in the color option.

{255,200,0}

group

Assigns a group to each data value, according to position in the list. An element in data is assigned to the string in group in the same list position. A separate boxplot is created for each group, which are drawn from left to right (or bottom to top) in alphabetical order of group name.

List of Strings, exactly as long as the length of data.

{} (empty list, everything is plotted in one boxplot)

labels

Provides labels for each group of data, written under (or to the side of) each box in the plot. If the labels option is not used, group names will be shown as labels. If less labels than groups are provided, the rightmost groups will be shown with no label. Note that in particular, setting labels={} removes all box labels from the plot.

A list of Strings.

auto (uses group names as labels)

notch

When set to true, boxes are notched at the median of the box. The notch extends to a 95% confidence interval.

Boolean.

false

orientation

Plot boxes either horizontally or vertically.

vertical or horizontal

vertical

show_outliers

When set to true, outliers are plotted as points. If false, outliers are not plotted.

Boolean.

true

title

Displays a title above the boxplot.

String.

"" (empty string)

whiskers_range

Adjusts the maximum length for which data can be shown as a whisker. If the largest value is under Q3 + whisker_range*IQR, it is plotted as a whisker. Similarly the smallest value above Q1 - whisker_range*IQR will be plotted as a whisker. Values outside of the whisker range are considered to be outliers.

Non-negative Float.

1.5