View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
boxplotCsub (boxplotC)

3.9 | 9 ratings Rate this file 11 Downloads (last 30 days) File Size: 8.11 KB File ID: #5316 Version: 1.9
image thumbnail

boxplotCsub (boxplotC)


Brian Katz (view profile)


20 Jun 2004 (Updated )

Revised version of boxplotC to allow coloring and subgroup plotting of boxplots.

| Watch this File

File Information

This function provides some additional propoerties to the standard boxplot display. The basic old syntax of boxplot is retained, for compatibility.
The primary purpose is to allow for GROUPED boxplots, or subplots, of color coded boxplots on the same graph. This is useful for boxplot data comparrisons over multiple variables. It is also possible to overlay boxplots or to simply color different sets differently.

This routine allows for subgroup plotting of colorcoded boxplots (boxplotCsub) using the subfunction boxplotC (which allows for multiple colored box plots to be overlayed). In addition, standard line color and line width definition is available, as well as the filled option. This allows for color coding multiple box plots and overlaying. Download ZIP contains boxplotCsub with a revised boxplotC and boxutilC.

Reverse compatible with standard boxplot old (v.2002) syntax. While less obvious than the current syntax, looking at the examples should help clarify usage for those unfamiliar with boxplot.

Due to changes in boxplot in v.2011, the old BOXPLOT syntax help has been inclued, along with several examples.

BOXPLOTC is now obsolete, and superceded by this function.


Boxplot C and Hatched Fill Patterns inspired this file.

Required Products Statistics and Machine Learning Toolbox
MATLAB release MATLAB 7.4 (R2007a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (12)
05 Feb 2016 Noel

Noel (view profile)

I think the function is well-conceived, but it would be great if one could specify a group of colors to accompany the grouping of data.

17 Jul 2015 Henrik

Henrik (view profile)

Very useful, works great.

01 Sep 2014 Brian Katz

Brian Katz (view profile)

To use the default values, you can simply use an empty matrix like so:
boxplotCsub(t1,1,[],[],[],[],[],[],[],[1 2]);
The reason for this design was that I chose to use the same syntax as boxplot (v.2002) with additional parameters *afterwards* in the input list. I do not think however that this is a big hindrance to its use once the syntax is understood.

Comment only
21 Feb 2014 Anton Semechko

Anton Semechko (view profile)

Thanks for making this function available Brian. I downloaded it mainly because of the feature that allows grouping of multiple box-plots (this option is specified by 'cur_tot' variable). Although at first glance this function seemed like a great utility as I attempted to plot some of my data, I very quickly became disenchanted.

In your code, you define a bunch of default settings. But what is the point of this if they are not used? Basically, in order to produce a plot you have to specify ten input arguments every time this function is called.

19 Jul 2012 Leila

Leila (view profile)

Wonderful code, it helped me alot too. Thanks.

31 Mar 2011 Brian Katz

Brian Katz (view profile)

Please see the different help examples, as well as the general use of MatLab's boxplot, which help clarify the syntax (based on the older original boxplot MatLab syntax). There is also a legend example to help users with this point. If you still have questions, please feel free to post them here.

Comment only
01 Apr 2009 Ged Ridgway

Ged Ridgway (view profile)

Requires Statistics toolbox for prctile function.

Comment only
03 Jul 2008 F Werner

Poorly documented & hard to use

13 Apr 2008 Gracee Agrawal

This program greatly helped me. Thanks a lot! Indeed help section should be improved. Also since it allows for subgroup plotting, there should be an option for adding legend to the plot.

10 Aug 2007 Hans van Dijk

Indeed the help could be inproved but for the rest it works nice.

12 Apr 2007 K. Seiler

This program was a great help for me! Thank you very much! If you want to use it, just save the files in your working directory and use examples from the program to understand how it works.

13 Jun 2006 Andreas Handel

'help boxplotC' gave information that was confusing. Couldn't understand it, therefore didn't try further. File might benefit from a more detailed explanation.

03 Mar 2009 1.1

Revised description only.

11 Jun 2010 1.2

Rev.2010 includes modification of box widths and control of overlap. Help modified to highlight these features.

31 Mar 2011 1.3

March 2011 revision includes the addition of mean symbol and variable widths.

21 Sep 2011 1.6

Small fonctionality, such as mean symbol. Fixes to various comments by users. As the BOXPLOT syntax has changed in recent versions of MatLab, I have copied the original help syntax as that is what is used here. BOXPLTCSUB now makes BOXPLOTC obsolete.

31 Aug 2012 1.8

Revised help to be more readable.
Corrected bug when using RGB color definitions.

02 Sep 2014 1.9

Added warning for h_ticklabels call when unavailable. Added additional example showing default settings usage.

Contact us