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.
Brian Katz (2020). boxplotCsub (boxplotC) (https://www.mathworks.com/matlabcentral/fileexchange/5316-boxplotcsub-boxplotc), MATLAB Central File Exchange. Retrieved .
As many things can be changed with each call (for each group) color group definitions was not included. However, you could do something equivalent quite easy with a FOR-loop. Here is an example;
mydataset = randn(10,2,3);
groupcolor = 'rgb';
for LOOP = 1:3,
boxplotCsub( mydataset(:,:,LOOP),1,,0,0,groupcolor(LOOP),true,0.5,false,[LOOP 3])
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.
Very useful, works great.
To use the default values, you can simply use an empty matrix like so:
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.
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.
Wonderful code, it helped me alot too. Thanks.
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.
Requires Statistics toolbox for prctile function.
Poorly documented & hard to use
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.
Indeed the help could be inproved but for the rest it works nice.
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.
'help boxplotC' gave information that was confusing. Couldn't understand it, therefore didn't try further. File might benefit from a more detailed explanation.
Added warning for h_ticklabels call when unavailable. Added additional example showing default settings usage.
Revised help to be more readable.
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.
March 2011 revision includes the addition of mean symbol and variable widths.
Rev.2010 includes modification of box widths and control of overlap. Help modified to highlight these features.
Revised description only.