MATLAB Answers


plotting multiple boxplots in the same figure window

Asked by Jenny
on 17 Nov 2012
Latest activity Commented on by Karim Tarbali
on 16 May 2015

I have 10 vectors of temperature data, all different lengths, that I want to make boxplots of and plot them all in the same figure window. How do I do this?



No products are associated with this question.

2 Answers

Answer by Tom Lane
on 19 Nov 2012

Here's how to do that with three vectors of different lengths:

x1 = rand(10,1); x2 = 2*rand(15,1); x3 = randn(30,1);
x = [x1;x2;x3];
g = [ones(size(x1)); 2*ones(size(x2)); 3*ones(size(x3))];

  1 Comment

Karim Tarbali
on 16 May 2015

thanKs a lot

Answer by Akiva Gordon
on 17 Nov 2012

Are you familiar with the SUBPLOT function? This may be what you are looking for…


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!