File Exchange

image thumbnail

boxplot2

version 1.0.0.0 (16.6 KB) by Kelly Kearney
An alternative boxplot function

33 Downloads

Updated 05 Jan 2018

GitHub view license on GitHub

The original boxplot.m function is more heavy-handed than most Matlab plotting functions; it replaces ticks with text labels, changes axis dimensions, etc. This version creates a boxplot with a minimal amount of alteration to existing axes, assuming that any cosmetic changes (color, tick labels, line specs, etc) can be added by the user afterwards if necessary.
Additionally, this function allows one to create clustered boxplots, similar to an unstacked bar graph.

Cite As

Kelly Kearney (2021). boxplot2 (https://github.com/kakearney/boxplot2-pkg), GitHub. Retrieved .

Comments and Ratings (16)

HE

Is there a possibility to add a legend for each group?

Raquel Felix

Jinping Wan

ting zhu

Jan

Filling the dataset with NaN works as expected.
Thank you Kelley. :-)

Kelly Kearney

@Jan and Peter, This function ignores NaNs, so you could add NaNs to your shorter datasets to allow the concatenation needed for this utility. Or alternatively, perhaps the original boxplot with the group input would better suit your needs.

Jan

Jan

@Peter,
Did you find any solution for your groups with different numbers of observations?
This would be really interesting.

Thanks in advance,
Jan

YongJun Choi

Ist

Ist

Peter McColgan

Is there are way to do this for groups with different numbers of observations?

Thanks so much.

Peter

Baijun Wu

Is there a way that I can change the linestyle of the box?Thanks a lot

Kelly Kearney

@Stephanie,

The tick labels can be altered via standard Matlab syntax, e.g.

set(gca, 'xticklabel', '')

will remove remove tick labels. Or you can use a combo of the XTick and XTickLabel properties to assign specific tick locations and labels.

Stephanie

Overall really appreciate this function as it grouped the boxplots exactly as I needed them.

Is there an easy way to get rid of the numeric x labels? It would make more sense to remove them if comparing numerous pair-wise boxplots within the same figure.

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

boxplot2

minmax