NOTE: this function is now available from the IoSR Matlab Toolbox as iosr.statistics.boxPlot.
Alternative box plot function for Matlab with many options. These options include:
- Variable sample sizes (via the tab2box() function).
- Show box sample size.
- Scaled or uniform box spacing.
- Box width scaled by sample size.
- Overlay scatter plots of underlying data.
- Overlay the mean of the data.
- Overlay additional percentiles, and attach labels to them.
- Hierarchical X-labeling and support for multidimensional data.
- Notched boxes.
- Vertical lines to separate groups.
- Automated construction of a legend.
- Set box limits as percentiles.
- Set whisker extent via various methods.
- Use of weighted quantiles.
- Creation of violin plots.
Christopher Hummersone (2023). Alternative box plot (https://github.com/IoSR-Surrey/MatlabToolbox), GitHub. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Versions that use the GitHub default branch cannot be downloaded
Updated version number.
Added percentile options for box and whisker extent. Modified help to clarify scatter plotting.
Added 'theme' property to allow multiple display properties to be changed simultaneously. Various bug fixes.
More bug fixes. Forced legend alpha to match box alpha.
Added ability to specify colors as a colormap function. Changed some size properties to no longer be specifiable for each group. Bug fixes.
Re-implemented function as a class (with a new name). Added property to automate construction of a legend.
Added meanSize property.
Corrected calculation of mean when data include NaN. Updated picture.
Added options for displaying the means.
Added trap for MarkerEdgeAlpha (scatterAlpha), which older versions of Matlab do not support.
Added layer and transparency options.
Fixed automatic placement of boxes.
Corrected bug where x offset was erroneous if y was not hierarchical.
Small tweaks to improve robustness.
Numerous changes to interface in order to support multidimensional data and improve hierarchical data labelling. Added scaleWidth option to scale box widths according to sample size.
Added x-shaping to outliers and tweaked offset distribution.
Added x shaping for overlayed scatter plots whereby the random x offset is related to the data distribution. Fixed bug whereby xSeparator handle would be sought even if xSeparator was not specified.
Shuffled a few things around so that the creation order defines the layering, rather than relying on uistack(). Added linkprop() and listener to keep axes in sync and to change xseparator if ylim changes.
Added options to: overlay a scatter plot of the underlying data, display the sample size in each box, add x-group separators, and add hierarchical labelling. Shuffled outputs slightly. Thanks to Arnold for the suggestions.
Fixed bug where x is a cell array of strings.
Remove NaN from x data (and corresponding y data).
Improved robustness to small or empty samples. Add tab2box function for arranging tabular into the format accepted by box_plot.
Function now natively supports sub-groups, handles NaNs more robustly, and returns sample size(s). A few other minor tweaks and doc changes.
Moved quantile calculation to new function.
Changed/corrected quantile estimation algorithm. Details in help text.