Why isn't there any simple command to create a grouped boxplot in MATLAB yet?

1 回表示 (過去 30 日間)
Sharah
Sharah 2016 年 10 月 9 日
編集済み: Massimo Zanetti 2016 年 10 月 9 日
I am trying to plot a grouped boxplot on MATLAB but surprisingly Excel can do better!Can anyone suggest the best way to create a grouped boxplot as easy as making one for barchart?

採用された回答

Massimo Zanetti
Massimo Zanetti 2016 年 10 月 9 日
編集済み: Walter Roberson 2016 年 10 月 9 日
Sure, there is matlab function specific for this: http://www.mathworks.com/help/stats/boxplot.html
load carsmall
boxplot(MPG,Origin)
title('Miles per Gallon by Vehicle Origin')
xlabel('Country of Origin')
ylabel('Miles per Gallon (MPG)')
  4 件のコメント
Sharah
Sharah 2016 年 10 月 9 日
Does the data needs to be the same size? What if we have different size?
Massimo Zanetti
Massimo Zanetti 2016 年 10 月 9 日
編集済み: Massimo Zanetti 2016 年 10 月 9 日
According to what I know, yes they must have the same size. The reason is that, the boxplot helps visualizing different feature distributions of the same dataset of samples. Assume you have 100 observed animals, and for any of them you observe height, weigth. Then your data will be 100x2 matrix.
However, if you really need to explain different sized data, here is how to do it: https://it.mathworks.com/matlabcentral/answers/60818-boxplot-with-vectors-of-different-lengths

サインインしてコメントする。

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by