File Exchange

image thumbnail

boxplotGroup

version 1.2.2 (4.08 KB) by Adam Danz
Group boxplots together along the x-axis with space between groups.

72 Downloads

Updated 09 Mar 2020

View License

x = {rand(100,2), rand(20, 2), rand(150,2)};
boxplotGroup(x)

The lines above will create two groups of three boxplot boxes per group, with space separating the groups.

You can specify the amount of space between groups, the primary labels under each box, and the secondary labels that identify the groups. Group labels can be horizontal, under the x-axis, or vertical, between groups.

Other boxplot properties can be passed to Matlab's boxplot function as well.

NOTE: If you're working with a grouping variable 'g', use the syntax boxplot(x,g) along with the "Group Appearance" options described in Matlab's boxplot() documentation.
https://www.mathworks.com/help/stats/boxplot.html#d118e146984

Also see Kelly Kearney's boxplot2()
https://www.mathworks.com/matlabcentral/fileexchange/59303-boxplot2

Cite As

Adam Danz (2020). boxplotGroup (https://www.mathworks.com/matlabcentral/fileexchange/74437-boxplotgroup), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (1)

Matlaber

Easy to use if want to plot multiple boxplot together, especially for writing a paper

Updates

1.2.2

Instead of creating a new axis when an axis handle is not provided, the current axis will be used via gca().

1.2.1

Suppress linkprops() and changes to toolbar suppression to work with versions prior to r2018b.

1.2.0

When 2nd axis is added, main axis is set to current axis.

1.1.0

Using linkprop and listener to resize axis2 when main axis is resized; axis handle provided in boxplot(); added DeleteFct to main axis; removed toolbar for axis2; other minor changes.

MATLAB Release Compatibility
Created with R2019b
Compatible with any release
Platform Compatibility
Windows macOS Linux