Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

plotting multiple boxplots in the same figure window

Asked by Jenny

Jenny (view profile)

on 17 Nov 2012

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?

0 Comments

Jenny

Jenny (view profile)

Products

No products are associated with this question.

2 Answers

Answer by Tom Lane

Tom Lane (view profile)

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))];
boxplot(x,g)

0 Comments

Tom Lane

Tom Lane (view profile)

Answer by Akiva Gordon

Akiva Gordon (view profile)

on 17 Nov 2012

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

http://www.mathworks.com/help/matlab/ref/subplot.html

0 Comments

Akiva Gordon

Akiva Gordon (view profile)

Contact us