/ Published in: MatLab
Plots a histogram from an external file with the frequency of each bin shown above each bar. The XTick is also the intervals of the histogram.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
%========================================================== % Plots a histogram % + Frequency labels % + Bin edges %========================================================== % Number of bins binNumbers = 10; % Load in data (single column data file) % Close any graphs currently open % Plot histogram % Run hist function again to grab bins % Set length of bins % Make graph fullscreen % Graph labels % Y-Offset value. Change accordingly offsetY = 33; % Put counts over the bars. for bin = 1 : binLength text(xout(bin), n(bin)+offsetY, caption, 'VerticalAlignment','bottom', 'HorizontalAlignment', 'center'); end % Bin edge variables % Set new intervals