How do I keep the number of bins used the same when generating a histogram along with how do I illustrate its depth with color?
1 view (last 30 days)
Show older comments
Andrew Stark
on 26 Nov 2020
Answered: Walter Roberson
on 26 Nov 2020
%Plotting Histogram
for i=1:3000
Zf2=Zf{i,1};
Df2=Df{i,1};
H=[Df2,Zf2];
hist3(H,[10 10])
hold on
end
I am trying to generate a histogram and when set to 1 iteration it generates this histogram
when set to 2 iterations it generates this histogram
How do I keep the number of bins the same and use color to illustrate the depth of the histogram?
0 Comments
Accepted Answer
Walter Roberson
on 26 Nov 2020
You are keeping the number of bins the same for the two histograms. The bins just are not aligned between the two plots, and you are using "hold on"
Remember that when you specify by number of bins, it takes the range of data and subdivides it into the given number of bins. When you have two different plots with different ranges, then the edges are not going to align.
You should be considering specifying bin centers or bin edges instead of numbers of bins.
For coloring use 'CDataMode', 'auto', 'FaceColor', 'interp'
0 Comments
More Answers (0)
See Also
Categories
Find more on Histograms 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!