BOXPLOT を使用して異なる長さのデータセットの箱ひげ図を描くことはできますか?
6 views (last 30 days)
Show older comments
それぞれ異なる長さの複数のデータセットがあります。例えば、A は 15 要素、B は 25 要素あります。これらのデータを BOXPLOT を使用して箱ひげ図として表示する方法を教えてください。
Accepted Answer
MathWorks Support Team
on 9 Nov 2012
BOXPLOT の引数は、サイズの異なるデータセットを受け付けません。BOXPLOT の引数の一つはまとまったデータセットで、もう一つはデータセットの値に対応するラベルとなります。そのため、二つの引数の長さが同じでなければいけません。
この問題を回避するには、二つのデータを一つの大きなデータセットとして扱います。もう一つの引数として、データセットの各値が属するラベル行列を作成します。
例えば、dataset1 と dataset2 が異なる長さの場合、以下のようなコードで箱ひげ図を作成します。
dataset = [dataset1 ; dataset2];
% where dataset1 and dataset2 are column vectors reprenting the original vector
troupname = [char(ones(length(dataset1),1)*'DATASET 1 '); char(ones(length(dataset2),1)*'DATASET 2')];
0 Comments
More Answers (0)
See Also
Categories
Find more on Computer Vision Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!