Combining and Visualizing two histograms

Hi,
I am having histogram plot of (x,y) =(15, 1000), this belongs to one class. And also I am having histogram plot of (x,y) = (15, 1500) of another class. (here, x axis same, but y axis different). I need to combine these two plots in a single plot separating each class. How can I do that? Pease help me with this. Thanks in advance.

1 件のコメント

Debadipto
Debadipto 2022 年 7 月 12 日
Can you share the code you've written so far?

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

 採用された回答

Abderrahim. B
Abderrahim. B 2022 年 7 月 12 日
編集済み: Abderrahim. B 2022 年 7 月 12 日

0 投票

Hi!
Use hold on, will be displayed in 2 different colors.
Example 1:
x = randi(10,20,1) ;
y = randi(10,20,1) ;
histogram(x);
hold on
histogram(y);
Example 2:
Use bar function
figure
bar([x, y], 'stacked')
legend x y

2 件のコメント

SP
SP 2022 年 7 月 12 日
Yeah, thank you for this one, but I need a single plot which combines or concatenates (like vertical concatenation) two plots, so that the output plot should be (x,y) = (30,1500).
Abderrahim. B
Abderrahim. B 2022 年 7 月 12 日
編集済み: Abderrahim. B 2022 年 7 月 12 日
I edited my answer. Check it and let me know if this is what you are trying to do!

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

その他の回答 (0 件)

カテゴリ

タグ

質問済み:

SP
2022 年 7 月 12 日

編集済み:

2022 年 7 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by