Boxplot for complete matrices (urgent)

10 views (last 30 days)
Marc
Marc on 20 May 2014
Commented: the cyclist on 21 May 2014
Hey there,
I am struggling with a problem ... I have ten matrices, each of which with a maximum of 49 columns and an undefined length (however, most of the matrices have a length of 100,000+ lines). The first column of each matrix is representing the date and time on which the line of data was captured (DD.MM.YY HH:MM:SS:SS if I remember this correctly right now) and can thus be ignored. Each other column is representing the error of a certain sensor.
What I want to do now is to create a figure with a boxplot for each of the ten matrices, each boxplot representing the complete according matrix. I want to do this to compare the matrices for unimportant reasons.
The Matlab boxplot function is strait forward. However, it seems like that I can only use it to create 48 boxplots in a figure for such matrices.
I hope someone can help me out :) I am running Matlab R2009b
Cheers from Germany

Answers (2)

the cyclist
the cyclist on 20 May 2014
Ignoring the first column of each matrix, you might have something like
size(M) = [100000 48];
As you say, if you do
boxplot(M)
then you will get one figure, with 48 boxes (one per column), where each box is the summary of 100,000 data points.
What is it that you actually want? Do you want one box for the entire matrix M, meaning one box for all 4800000 data points?
Then you could do
boxplot(M(:))
for each matrix, and do a loop over your ten matrices.
If that's not what you want, you need to explain it a bit better.

Marc
Marc on 21 May 2014
Sometimes, the solution is just that easy. And it's a little bit embarrassing that I haven't had the same idea ;)
However, the result looks kinda odd to me. I attached a screenshot that shows the results. On the left you can see the result for
boxplot(A(:))
and on the right you can see the result for
boxplot(A)
Now, the left plot is the one I want. But the mass of +-signs looks weird ... any idea?
And also, I need to put ten matrices in this figure. Do I have to work with hold on and manually placing the figures?
Thanks in advance
  1 Comment
the cyclist
the cyclist on 21 May 2014
The + signs are there because they are "outliers", which lie beyond the whisker. Because you have a relatively huge amount of data, you have a large number of outliers (even if they are a small percentage of the total). You can change the length of the whisker if you want. (See my answer here on how to do that.)
Regarding getting all ten boxes in one plot ...
You might be able to put your data in one giant (4800000 x 10) array and apply boxplot just once. I was able to do that with some test data.
Otherwise, you'll just need to use hold, as you describe.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!