How to do Box plot for multiple variables? Codes please.

1 view (last 30 days)
Hello, I want to summarize my simulation data by visualizing them in box plot where there are 25 different simulations. These are assorted in excel file as matrix (165237 rows, 25 columns) which means i have 165237 individual data points for these 25 various simulations.
My question is how to do box plot with multiple variables (here i am considering these simulations as variables). Please help me with giving matlab codes....
Here is what I have used as codes: (matlab is showing lots of errors)
---------------------------------------------------
Reff = xlsread('All simulation values of Reff (10nm-50nm).xlsx','A2:A165238');
b3_a2_mw_mr_r_i = xlsread('All simulation values of Reff (10nm 50nm).xlsx','B2:B165238');
b3_a2_mr_r_i = xlsread('All simulation values of Reff (10nm-50nm).xlsx','C2:C165238');
b3_a2_mw_r_i = xlsread('All simulation values of Reff (10nm-50nm).xlsx','D2:D165238');
b3_a2_mw_mr_r = xlsread('All simulation values of Reff (10nm-50nm).xlsx','E2:E165238');
b3_a2_mw_mr_i = xlsread('All simulation values of Reff (10nm-50nm).xlsx','F2:F165238');
b3_a2_mw_mr = xlsread('All simulation values of Reff (10nm-50nm).xlsx','G2:G165238');
b3_a2_r_i = xlsread('All simulation values of Reff (10nm-50nm).xlsx','H2:H165238');
b3_a2_mw_r = xlsread('All simulation values of Reff (10nm-50nm).xlsx','I2:I165238');
b3_a2_mw_i = xlsread('All simulation values of Reff (10nm-50nm).xlsx','J2:J165238');
b3_a2_mr_r = xlsread('All simulation values of Reff (10nm-50nm).xlsx','K2:K165238');
b3_a2_mr_i = xlsread('All simulation values of Reff (10nm-50nm).xlsx','L2:L165238');
b3_a2_mw = xlsread('All simulation values of Reff (10nm-50nm).xlsx','M2:M165238');
b3_a2_mr = xlsread('All simulation values of Reff (10nm-50nm).xlsx','N2:N165238');
b3_a2_r = xlsread('All simulation values of Reff (10nm-50nm).xlsx','O2:O165238');
b3_a2_i = xlsread('All simulation values of Reff (10nm-50nm).xlsx','P2:P165238');
b3_a2 = xlsread('All simulation values of Reff (10nm-50nm).xlsx','Q2:Q165238');
b3_a_355 = xlsread('All simulation values of Reff (10nm-50nm).xlsx','R2:R165238');
b3_a_532 = xlsread('All simulation values of Reff (10nm-50nm).xlsx','S2:S165238');
r_i_mr_mw = xlsread('All simulation values of Reff (10nm-50nm).xlsx','T2:T165238');
b3 = xlsread('All simulation values of Reff (10nm-50nm).xlsx','U2:U165238');
a2_b2_355_532 = xlsread('All simulation values of Reff (10nm-50nm).xlsx','V2:V165238');
r_i = xlsread('All simulation values of Reff (10nm-50nm).xlsx','W2:W165238');
mr_mw = xlsread('All simulation values of Reff (10nm-50nm).xlsx','X2:X165238');
a2 = xlsread('All simulation values of Reff (10nm-50nm).xlsx','Y2:Y165238');
X(1,:) = Reff;
X(2,:) = b3_a2_mw_mr_r_i;
X(3,:) = b3_a2_mr_r_i;
X(4,:) = b3_a2_mw_r_i;
X(5,:) = b3_a2_mw_mr_r;
X(6,:) = b3_a2_mw_mr_i;
X(7,:) = b3_a2_mw_mr;
X(8,:) = b3_a2_r_i;
X(9,:) = b3_a2_mw_r;
X(10,:) = b3_a2_mw_i;
X(11,:) = b3_a2_mr_r;
X(12,:) = b3_a2_mr_i;
X(13,:) = b3_a2_mw;
X(14,:) = b3_a2_mr;
X(15,:) = b3_a2_r;
X(16,:) = b3_a2_i;
X(17,:) = b3_a2;
X(18,:) = b3_a_355;
X(19,:) = b3_a_532;
X(20,:) = r_i_mr_mw;
X(21,:) = b3;
X(22,:) = a2_b2_355_532;
X(23,:) = r_i;
X(24,:) = mr_mw;
X(25,:) = a2;
boxplot(X,'plotstyle','compact');
-----------------------------------------------------
  2 Comments
Tom Lane
Tom Lane on 20 Feb 2013
Care to say what the errors are, and whether they are coming from boxplot or elsewhere?
Walter Roberson
Walter Roberson on 20 Feb 2013
Which operating system is being used? Which MATLAB version? If you are using MS Windows, which Excel version?
Are the errors complaining about you having more then 65535 rows in the array?

Sign in to comment.

Answers (1)

Thorsten
Thorsten on 20 Feb 2013
boxplot(X) produces a box and whisker plot with one box for each column of X. So if you have 25 columns you get a box for each column that summarizes your 165237 individual data points. Try
boxplot(rand(165237, 25), plotstyle','compact');

Community Treasure Hunt

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

Start Hunting!