How to display multiple histograms in one window?

9 ビュー (過去 30 日間)
JFz
JFz 2016 年 12 月 9 日
コメント済み: JFz 2016 年 12 月 9 日
Hi, I have a matrix of 8X100 doubles (8 rows and 100 columns) named 'cMat8x100'. I would like to display the data as 8 histograms in one window. Here is my code: >>[nHistC, cEdges] = histcounts(cMat8x100, 20); >>figure >>bar(cEdges(1:end-1), nHistC); But it displays only one histogram. How to make it to display 8 of them in one window? Thanks.

採用された回答

Steven Lord
Steven Lord 2016 年 12 月 9 日
You want the graphical output, not just the bin counts. Because of that you should call histogram eight times (once per row in your matrix) instead of calling histcounts. Use hold on to add each new histogram object to the same axes rather than clearing the axes each time you call histogram.
  3 件のコメント
JFz
JFz 2016 年 12 月 9 日
Just tried it. It works. But the histograms are all lump together. I should have mentioned that I would like to display 4 on top and 4 below...
JFz
JFz 2016 年 12 月 9 日
Now, I am using subplot and I can do it. Thanks.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeHistograms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by