BoxWhiskerChart

BoxWhiskerChart[{x1,x2,}]

makes a boxandwhisker chart for the values xi.

BoxWhiskerChart[{x1,x2,},bwspec]

makes a chart with boxandwhisker symbol specification bwspec.

BoxWhiskerChart[{data1,data2,},]

makes a chart with boxandwhisker symbol for each datai.

BoxWhiskerChart[{{data1,data2,},},]

makes a boxandwhisker chart from multiple groups of datasets {data1,data2,}.

Details and Options

  • BoxWhiskerChart draws a box-and-whisker summary of the distribution of values in each datai.
  • The following box-and-whisker specifications bwspec can be given:
  • "Notched"median confidence interval notch
    "Outliers"outlier markers
    "Median"median marker
    "Basic"box-and-whisker only
    "Mean"mean marker
    "Diamond"mean confidence interval diamond
    {{elem1,val11,},}box-and-whisker element specification
    {"name",{elem1,val11,},}named bwspec with element modifications
  • The elements and values include:
  • {"Fences",width,style}width and style of fences
    {"MeanDiamond",width,style}width and style of mean confidence interval
    {"MeanMarker",width,style}width and style of mean marker line
    {"MedianNotch",width,style}width and style of median confidence interval
    {"MedianMarker",width,style}width and style of median marker line
    {"Outliers",marker,style}marker symbol and style for outliers
    {"FarOutliers",marker,style}marker symbol and style for far outliers
    {"Whiskers",style}style for whiskers
  • The width is given as a fraction of the width of the box, and the marker can be any expression.
  • Data elements for BoxWhiskerChart can be given in the following forms:
  • dataia pure dataset
    Quantity[datai,unit]data datai with units
    wi[datai,]data datai with wrapper wi
    formi->midata with metadata mi
  • Each datai should be a list of real numbers {y1,y2,}. Elements yj that are not real numbers are taken to be missing and are excluded. If datai is not a list of real numbers, it is taken to be missing data and will typically result in the gap in the box-and-whisker chart.
  • Datasets for BoxWhiskerChart can be given in the following forms:
  • {data1,data2,}list of elements with or without wrappers
    <|k1data1,k2data2,|>association of keys and datasets
    TimeSeries[],EventSeries[],TemporalData[]time series, event series, and temporal data
    WeightedData[],EventData[]augmented datasets
    w[{data1,data2,},]wrapper applied to a grouped dataset
    w[{{data1,data1,},},]wrapper applied to all grouped datasets
  • Possible symbolic wrappers are the same as for BarChart and include Style, Labeled, Legended, etc.
  • In BoxWhiskerChart, Labeled and Placed allow the following positions:
  • Top,Bottom,Left,Right,Centerpositions within the box
    Above, Below, Before, Afterpositions outside the box and other elements
    Axison the bar origin axis
    "LowerFence","LowerQuartile","MedianMarker","MeanMarker","UpperQuartile","UpperFence"positions given by box-and-whisker elements
    {{bx,by},{lx,ly}}scaled position {lx,ly} in the label at scaled position {bx,by} for the box-and-whisker elements
  • BoxWhiskerChart has the same options as Graphics, with the following additions and changes:
  • AspectRatio 1/GoldenRatiooverall ratio of height to width
    BarOrigin Bottomwhere to place smallest value for box-and-whisker
    BarSpacing Automaticfractional spacing between box-and-whiskers
    ChartBaseStyle Automaticoverall style for box-and-whiskers
    ChartElementFunction Automatichow to generate raw graphics for box
    ChartLabels Nonelabels for data elements and datasets
    ChartLegends Nonelegends for data elements and datasets
    ChartStyle Automaticstyle for box
    Frame Truewhether to draw a frame around the chart
    Joined Falsewhether to join medians
    LabelingFunction Automatichow to label box-and-whisker elements
    LabelingSize Automaticmaximum size of callouts and labels
    LegendAppearanceAutomaticoverall appearance of legends
    Method Automaticwhat methods to use
    PerformanceGoal $PerformanceGoalaspects of performance to try to optimize
    PlotTheme $PlotThemeoverall theme for the chart
    ScalingFunctions Nonehow to scale individual coordinates
    TargetUnitsAutomaticunits to display in the chart
  • The arguments supplied to ChartElementFunction are the box region {{xmin,xmax},{ymin,ymax}}, the data datai, and metadata {m1,m2,} from each level in a nested list of datasets.
  • A list of built-in settings for ChartElementFunction can be obtained from ChartElementData["BoxWhiskerChart"].
  • With ScalingFunctions->s, the data coordinate is scaled using s.
  • Style and other specifications from options and other constructs in BoxWhiskerChart are effectively applied in the order ChartStyle, Style and other wrappers, and ChartElementFunction, with later specifications overriding earlier ones.

Examples

open allclose all

Basic Examples  (6)

Generate a box-and-whisker chart for a data vector:

Generate a box-and-whisker chart for a list of data vectors:

Chart several collections of datasets:

Customize the appearance of the box-and-whisker chart:

Show outliers:

Use categorical labels:

Categorical legends:

Show outliers:

Show notches for the median confidence interval:

Scope  (45)

Data and Wrappers  (17)

Single data vector:

Multiple data vectors:

Data vectors in a dataset are grouped together:

Datasets do not need to have the same number of data vectors:

Nonreal data is taken to be missing and typically yields a gap in the box-and-whisker chart:

A nonreal entry in a data vector is omitted:

The data may include units:

Specify the units to use:

The time stamps in TimeSeries, EventSeries, and TemporalData are ignored:

The values in associations are taken as the heights of the bars:

Use the keys as labels:

Use the keys as legends:

Associations can be nested:

Use WeightedData to add weights to data:

Use EventData to add censoring and truncation information:

Use wrappers on an individual data vector, datasets, or collections of datasets:

Inner wrappers take precedence over outer wrappers:

Override the default tooltips:

Use PopupWindow to provide additional drilldown information:

Use the other charting function in PopupWindow to provide more information:

Button can be used to trigger any action:

Elements  (11)

Use named presets:

Style the whiskers:

Vary the width of the fences:

Style the fences:

Use different shapes for outliers:

Style the outliers:

Use different shapes for far outliers:

Style the far outliers:

Vary the width of the median marker:

Style the median marker:

Use a different shape of median marker:

Do not show the median marker:

Vary the width of the median confidence interval:

Style the median confidence interval:

Vary the width of the mean marker:

Style the mean marker:

Use a different shape of mean marker:

Vary the width of the mean confidence interval:

Style the mean confidence interval:

Combine individual elements with named presets:

Combine elements with ChartElementFunction:

Styling and Appearance  (9)

Use an explicit list of styles for the box-and-whiskers:

Use any gradient or indexed color schemes from ColorData:

Use color schemes designed for charting:

ChartBaseStyle can be used to set an initial style for all chart elements:

Style can be used to override styles:

Use built-in programmatically generated bars:

For detailed settings use Palettes ChartElementSchemes:

Use a theme with simple ticks and grid lines:

Use a theme with detailed ticks and a reference line:

Change the origin of box-and-whiskers:

Adjust the spacing between individuals and groups of box-and-whiskers:

Labeling and Legending  (8)

Use Labeled to add a label to a box-and-whisker:

Use symbolic positions for label placement:

Provide categorical labels for the columns of data:

For rows of data:

For both:

Use Placed to control the positioning of labels, using the same positions as for Labeled:

Provide value labels for box-and-whisker by using LabelingFunction:

Use Placed to control placement and formatting:

Add categorical legend entries for the columns of data:

For rows of data:

Use Legended to add additional legend entries:

Use Placed to affect the positioning of legends:

Options  (96)

AspectRatio  (3)

By default, AspectRatio uses a fixed ratio of the height to the width of the plot:

Make the height the same as the width with AspectRatio1:

AspectRatioFull adjusts the height and width to tightly fit inside other constructs:

Axes  (4)

By default, BoxWhiskerChart uses a frame instead of axes:

Use axes instead of a frame:

Use AxesOrigin to specify where the axes intersect:

Turn each axis on individually:

AxesLabel  (4)

No axes labels are drawn by default:

Place a label on the axis:

Specify axes labels:

Use units as labels:

AxesOrigin  (2)

The position of the axes is determined automatically:

Specify an explicit origin for the axes:

AxesStyle  (4)

Change the style for the axes:

Specify the style of each axis:

Use different styles for the ticks and the axes:

Use different styles for the labels and the axes:

BarOrigin  (1)

Change the bar origin:

BarSpacing  (4)

BoxWhiskerChart automatically selects the spacing between bars:

With groups of data:

Use symbolic spacing:

With groups of data:

Use explicit spacing between bars:

With groups of data:

Use no bar spacing:

Within groups of data:

ChartBaseStyle  (3)

Use ChartBaseStyle to style box-and-whisker charts:

ChartBaseStyle combines with ChartStyle:

ChartStyle may override settings for ChartBaseStyle:

ChartElementFunction  (3)

Get a list of built-in settings for ChartElementFunction:

For detailed settings, use Palettes ChartElementSchemes:

Use named specifications with ChartElementFunction:

ChartLabels  (9)

By default labels are placed under the frame:

Use Placed to control label placement:

Symbolic positions outside the bar:

Use positions relative to the box-and-whisker charts:

Use group labels to label groups:

Coordinate-based placement relative to a bar:

Place all labels at the upper-right corner and vary the coordinates within the label:

Use the third argument to Placed to control formatting:

Place multiple labels:

ChartLegends  (1)

Generate a legend based on chart style:

Place the legend below the chart:

ChartStyle  (5)

Use ChartStyle to style the bars:

Give a list of styles:

Use "Gradient" colors from ColorData:

Use "Indexed" colors from ColorData:

Styles are used cyclically:

Style datasets in a group:

Style groups of datasets:

Element styles override ChartStyle:

Frame  (4)

BoxWhiskerChart uses a frame by default:

Use FrameFalse to turn off the frame:

Draw a frame on the left and right edges:

Draw a frame on the left and bottom edges:

FrameLabel  (3)

Place a label along the bottom frame of a chart:

Frame labels are placed on the bottom and left frame edges by default:

Place labels on each of the edges in the frame:

FrameStyle  (2)

Specify a style for the frame:

Specify style for each frame edge:

FrameTicks  (6)

Frame ticks are placed automatically by default:

Use All to include tick labels on both left and right edges:

Place tick marks at the specified positions:

Draw frame tick marks at the specified positions with specific labels:

Specify the lengths for tick marks as a fraction of the graphics size:

Use different sizes in the positive and negative directions for each tick mark:

Specify a style for each frame tick:

FrameTicksStyle  (3)

By default, frame ticks and frame tick labels use the same styles as the frame:

Specify an overall style for the ticks, including the labels:

Use a different style for each frame edge:

ImageSize  (7)

Use named sizes such as Tiny, Small, Medium and Large:

Specify the width of the plot:

Specify the height of the plot:

Allow the width and height to be up to a certain size:

Specify the width and height for a graphic, padding with space if necessary:

Setting AspectRatioFull will fill the available space:

Use maximum sizes for the width and height:

Use ImageSizeFull to fill the available space in an object:

Specify the image size as a fraction of the available space:

Joined  (1)

Join the medians of the datasets:

LabelingFunction  (2)

By default, bars have tooltips with a summary table of the data:

Define a labeling function and place it in a tooltip:

LabelingSize  (4)

Textual labels are shown at their actual sizes:

Image labels are automatically resized:

Specify a maximum size for textual labels:

Specify a maximum size for image labels:

Show image labels at their natural sizes:

Method  (3)

Use bar widths proportional to the square root of the data sizes:

Use bar widths proportional to the data sizes:

Put bars on fixed positions with varying bar spacing:

Use constant-width bars:

BoxWhiskerChart uses Quartiles to calculate quartiles and extremes:

Use Quantile instead:

Use Quantile with parameters for mode-based estimates:

Create a box-whisker plot using precomputed statistics:

PerformanceGoal  (3)

Generate a box-and-whisker chart with interactive highlighting:

Emphasize performance by disabling interactive behaviors:

Typically less memory is required for non-interactive charts:

PlotTheme  (2)

Use a theme with a high contrast color scheme and glassy rectangle boxes:

Change the chart style:

ScalingFunctions  (3)

Linear scale is used by default:

Use log scale in the coordinate:

When logarithm scale is used, non-positive data is dropped automatically:

Ticks  (6)

Ticks are placed automatically for each axis:

Use TicksNone to draw axes without any tick marks:

Place tick marks at the specified positions:

Draw tick marks at the specified positions with specific labels:

Specify the lengths for ticks as a fraction of graphics size:

Use different sizes in the positive and negative directions for each tick:

Specify a style for each tick:

TicksStyle  (4)

By default, the ticks and tick labels use the same styles as the axis:

Specify an overall style for the ticks including tick labels:

Specify ticks style for each of the axes:

Use a different style for the tick labels and tick marks:

Applications  (3)

Compare the distribution of salaries for several departments at a university:

A -test for equal location of two populations effectively checks for overlap in confidence intervals about their means. BoxWhiskerChart can be used to perform a visual -test:

The mean diamonds do not overlap. The null hypothesis is rejected at the 5% level:

The mean diamonds overlap. There is not enough evidence to reject the null hypothesis:

Compare different time slices of a random process:

Properties & Relations  (6)

Outliers and far outliers are defined using the quartiles and interquartile range:

Use DistributionChart to show distribution of data:

BoxWhiskerChart is a case of DistributionChart:

Use Histogram and SmoothHistogram to visualize a list of data vectors:

Use QuantilePlot and ProbabilityPlot to compare data to distributions:

Use Histogram3D and SmoothHistogram3D to visualize two-dimensional data vectors:

Wolfram Research (2010), BoxWhiskerChart, Wolfram Language function, https://reference.wolfram.com/language/ref/BoxWhiskerChart.html (updated 2018).

Text

Wolfram Research (2010), BoxWhiskerChart, Wolfram Language function, https://reference.wolfram.com/language/ref/BoxWhiskerChart.html (updated 2018).

CMS

Wolfram Language. 2010. "BoxWhiskerChart." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2018. https://reference.wolfram.com/language/ref/BoxWhiskerChart.html.

APA

Wolfram Language. (2010). BoxWhiskerChart. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BoxWhiskerChart.html

BibTeX

@misc{reference.wolfram_2022_boxwhiskerchart, author="Wolfram Research", title="{BoxWhiskerChart}", year="2018", howpublished="\url{https://reference.wolfram.com/language/ref/BoxWhiskerChart.html}", note=[Accessed: 06-June-2023 ]}

BibLaTeX

@online{reference.wolfram_2022_boxwhiskerchart, organization={Wolfram Research}, title={BoxWhiskerChart}, year={2018}, url={https://reference.wolfram.com/language/ref/BoxWhiskerChart.html}, note=[Accessed: 06-June-2023 ]}