Combining and Visualizing two histograms
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
SP
am 12 Jul. 2022
Bearbeitet: Abderrahim. B
am 12 Jul. 2022
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 Kommentar
Akzeptierte Antwort
Abderrahim. B
am 12 Jul. 2022
Bearbeitet: Abderrahim. B
am 12 Jul. 2022
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 Kommentare
Abderrahim. B
am 12 Jul. 2022
Bearbeitet: Abderrahim. B
am 12 Jul. 2022
I edited my answer. Check it and let me know if this is what you are trying to do!
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Histograms finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!