BoxWhiskerChart

BoxWhiskerChart[{x1, x2, ...}]
makes a box-and-whisker chart for the values .

BoxWhiskerChart[{x1, x2, ...}, bwspec]
makes a chart with box-and-whisker symbol specification bwspec.

BoxWhiskerChart[{data1, data2, ...}, ...]
makes a chart with box-and-whisker symbol for each .

BoxWhiskerChart[{{data1, data2, ...}, ...}, ...]
makes a box-and-whisker chart from multiple groups of datasets .

Details and OptionsDetails and Options

  • BoxWhiskerChart draws a box-and-whisker summary of the distribution of values in each .
  • 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
    wi[datai,...]data with wrapper
    formi->midata with metadata
  • Each should be a list of real numbers . Elements that are not real numbers are taken to be missing and are excluded. If 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
    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 in the label at scaled position for the box-and-whisker elements
  • BoxWhiskerChart has the same options as Graphics, with the following additions and changes:
  • AspectRatio1/GoldenRatiooverall ratio of width to height
    AxesTruewhether to draw axes
    BarOriginBottomwhere to place smallest value for box-and-whisker
    BarSpacingAutomaticfractional spacing between box-and-whiskers
    ChartBaseStyleAutomaticoverall style for box-and-whiskers
    ChartElementFunctionAutomatichow to generate raw graphics for box
    ChartLabelsNonelabels for data elements and datasets
    ChartLegendsNonelegends for data elements and datasets
    ChartStyleAutomaticstyle for box
    JoinedFalsewhether to join medians
    LabelingFunctionAutomatichow to label box-and-whisker elements
    LegendAppearanceAutomaticoverall appearance of legends
    MethodAutomaticwhat methods to use
    PerformanceGoal$PerformanceGoalaspects of performance to try to optimize
    ScalingFunctionsNonehow to scale individual coordinates
  • The arguments supplied to ChartElementFunction are the box region , the data , and metadata from each level in a nested list of datasets.
  • A list of built-in settings for ChartElementFunction can be obtained from .
  • 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.

ExamplesExamplesopen allclose all

Basic Examples (6)Basic Examples (6)

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

In[1]:=
Click for copyable input
Out[1]=

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

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=

Chart several collections of datasets:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=

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

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=

Show outliers:

In[3]:=
Click for copyable input
Out[3]=

Use categorical labels:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=

Categorical legends:

In[3]:=
Click for copyable input
Out[3]=

Show outliers:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
Out[2]=

Show notches for the median confidence interval:

In[3]:=
Click for copyable input
Out[3]=
New in 8
New to Mathematica? Find your learning path »
Have a question? Ask support »