File Exchange

image thumbnail

multiple_boxplot.m

version 1.2.0.0 (1.72 KB) by Ander Biguri
Grouped boxplots matlb ploting function

43 Downloads

Updated 15 Jul 2014

View Version History

View License

This boxplot function plots grouped boxes, for more advanced statistical analysis.
Features:
-In each boxplot different amount of data supported
-Any amount of groups and boxplot per group supported
-Xlabel and boxplotlabel supported
-Automatic choice of colors or user specified colors
Example of use:

clear;clc;
% Create example data
A=rand(100,10);
B=rand(200,10);
C=rand(150,10);

% prepare data
data=cell(10,3);
for ii=1:size(data,1)
Ac{ii}=A(:,ii);
Bc{ii}=B(:,ii);
Cc{ii}=C(:,ii);
end
data=vertcat(Ac,Bc,Cc);

xlab={'Hey','this','works','pretty','nicely.','And','it','has','colors','!!!!'};
col=[102,255,255, 200;
51,153,255, 200;
0, 0, 255, 200];
col=col/255;

multiple_boxplot(data',xlab,{'A', 'B', 'C'},col')
title('Here it is!')

Cite As

Ander Biguri (2020). multiple_boxplot.m (https://www.mathworks.com/matlabcentral/fileexchange/47233-multiple_boxplot-m), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (7)

Dominic Norberg

good stuff, thanks.

Cg Gc

Can anyone help me figure out why the legend is showing the colors in the reverse order? In the legend, Winter appears on top while Summer appears on the bottom.
A=SMR;%These are only Summer.
B=WNTR; %These are only Winter.
data=vertcat(Ac,Bc);
multiple_boxplot(data',xlab,{'Summer', 'Winter'},col')

Yubo Fan

JW

Weizhe Chen

Catherine is right. But it doesn't matter. Thanks!

Vidz

Catherine

Hi Ander,

In the preamble of the function you mention that "data is a cell matrix of MxL", but later in the code, you write :

M=size(data,2);
L=size(data,1);

In the MATLAB language, the first dimension is the number of rows, and the second the number of columns. The description in the preamble is thus misleading.

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

Community Treasure Hunt

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

Start Hunting!