present 2 histograms in the same X axis values
24 views (last 30 days)
Show older comments
sani on 25 Mar 2020
Commented: Adam Danz on 27 Mar 2020
I'm trying to plot 2 histograms in the same x axis. they suppose to have common peaks and I'd like to present them at the same scale so the peaks will overlap. is theres a way to do it?
this is the result I want to achive, but in here I used histcount and it made some other troubles.
Edited: Adam Danz on 27 Mar 2020
Adam Danz on 27 Mar 2020
I'm also struggling a bit to understand the end goal but from what I understand, you have two data sets, one with n values and the other with m values (n ~= m) and you'd like the histogram bins to match. Is that correct?
If so, try this:
combinedData = [data1(:); data2(:)];
edges = linspace(min(combinedData), max(combinedData), 20); % the 20 is the number of bins
Find more on Data Distribution Plots 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!