Clear Filters
Clear Filters

adjustment of the histogram bar's thickness

23 views (last 30 days)
%I need to reduce the bars thickness of histogram

Accepted Answer

dpb on 12 Jul 2014
Use bar instead; much simpler to control...
doc bar % for the rest of the details...

More Answers (2)

Image Analyst
Image Analyst on 15 Aug 2014
To make bars narrower or less thick, adjust the barwidth property between 0 and 1
bar(binCenters, binHeights, 'BarWidth', 0.3); % Narrow bars
bar(binCenters, binHeights, 'BarWidth', 1.0); % Widest possible bars
  1 Comment
Chad Greene
Chad Greene on 15 Aug 2014
It is possible for bars to be wider than 1.0.
y = randn(10000,1);
produces this:
To see it a bit more clearly (pun?), make the bars semitransparent:
y = randn(10000,1);
I've plotted the above with histf but barwidth exceeding 1.0 is also possible with bar.

Sign in to comment.

Chad Greene
Chad Greene on 14 Aug 2014
Or histf.


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!