How to get values over x-axis from a plotted Histogram?
Ältere Kommentare anzeigen
I plotted a histogram using the historgram() method, somewhat similar to this-

I wish to note the values over y-axis and x-axis.
I can get the values over y-axis pretty easily using histogram.Values.
For corresponding x-axis values, using the histogram.BinEdges, I get values as: -0.5 0.5 1.5 2.5 3.5 4.5 5.5, but what I want is: 0 1 2 3 4 5.
I tried looking into complete properties of Histogram but coudln't found a property useful to me.
I could do that manually by running the following piece of code.
ranges=Histogram.BinEdges;
x=zeros(Histogram.NumBins,1);
for i=1:Histogram.NumBins
x(i)=(ranges(i)+ranges(i+1))/2;
end
But I believe there should be some inbuilt method/property to do this.
So, is there some property/method which I can use to get the desired values?
1 Kommentar
KALYAN ACHARJYA
am 25 Apr. 2020
x axes> bin Values
y axis> Counts
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Histograms finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!