How to use box plots for irregular x-axis intervals?

2 ビュー (過去 30 日間)
Dawn
Dawn 2014 年 5 月 30 日
コメント済み: dpb 2014 年 5 月 30 日
I would like to use box plots for data that are collected at irregular time intervals. How can I plot multiple boxes at specific x-locations instead of just having them regularly spaced?
Thanks.
  1 件のコメント
Dawn
Dawn 2014 年 5 月 30 日
編集済み: Dawn 2014 年 5 月 30 日
Thanks everyone. After trying out some, the following code works for me. It takes care of plotting data sets of different sizes and plotting them at irregular x-intervals.
x = rand(5,1); y = rand(10,1); z = rand(15,1); Xpos = [1 5 12];
group = [repmat(Xpos(1), 5, 1); repmat(Xpos(2), 10, 1); repmat(Xpos(3), 15, 1)];
boxplot([x;y;z], group,'positions', Xpos, 'labels', Xpos)

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

採用された回答

dpb
dpb 2014 年 5 月 30 日
While I've not used it, the optional GROUPING input variable should suffice in conjunction with the 'positions' named parameter. See the doc for details...there are a couple of examples of doing so it appears.

その他の回答 (1 件)

José-Luis
José-Luis 2014 年 5 月 30 日
You can't. At least not if you use the boxplot() function. You'd have to create your own variant. Alternatively you could create dummy data at regular timesteps and make them transparent.
  1 件のコメント
dpb
dpb 2014 年 5 月 30 日
So, since it led to the solution, accept the answer???

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

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by