Creating a boxplot for every row in a matrix

I'm looking for an easy and fast way to make a boxplot for every row in a huge matrix (1000000 x 20) and showing all these boxes in one plot. In addtion, I wanted to show in the x axis the group name, the first row is named 1, the second is 2 and so on to the end of the 20. I have attached a picture of what I'm looking for.
Can you pleaes help.

Antworten (1)

Mark Sherstan
Mark Sherstan am 29 Jan. 2019
Bearbeitet: Mark Sherstan am 29 Jan. 2019

0 Stimmen

Try this:
A = randi(6,[100,20]);
boxplot(A)
If your plot starts to feel crowded consider using a subplot to split it up.

3 Kommentare

Yaser Khojah
Yaser Khojah am 29 Jan. 2019
When I do that i get this plot
untitled.png
However, if I create the first row alone I get the following which does not match the first box plot in figure 1 at x-axis 1.Anyway to present them better?
2.png
Mark Sherstan
Mark Sherstan am 29 Jan. 2019
It has to do with your data and trying to fit everything into one plot when your items may be scaled differently. As per the documentation:
On each box, the central mark indicates the median, and the bottom and top edges of the box indicate the 25th and 75th percentiles, respectively. The whiskers extend to the most extreme data points not considered outliers, and the outliers are plotted individually using the '+' symbol.
Do you have the same data as the initial plot your provided in your question?
Yaser Khojah
Yaser Khojah am 29 Jan. 2019
Thanks Mark, I found the reason and thank you so much for your help.

Melden Sie sich an, um zu kommentieren.

Tags

Gefragt:

am 29 Jan. 2019

Kommentiert:

am 29 Jan. 2019

Community Treasure Hunt

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

Start Hunting!

Translated by