adjustment of the histogram bar's thickness

조회 수: 11 (최근 30일)
sermet
sermet 2014년 7월 12일
댓글: Chad Greene 2014년 8월 15일
data=[-0.00044;0.01355;0.00755;0.00455;0.01555;0.01955;0.00555;0.00455;0.01755;0.01655];
figure;
hist(data)
%I need to reduce the bars thickness of histogram

채택된 답변

dpb
dpb 2014년 7월 12일
Use bar instead; much simpler to control...
[n,x]=hist(data);
h=bar(x,n);
doc bar % for the rest of the details...

추가 답변 (2개)

Image Analyst
Image Analyst 2014년 8월 15일
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
Chad Greene
Chad Greene 2014년 8월 15일
It is possible for bars to be wider than 1.0.
y = randn(10000,1);
histf(y,'barwidth',1.5)
produces this:
To see it a bit more clearly (pun?), make the bars semitransparent:
y = randn(10000,1);
histf(y,'barwidth',1.5,'alpha',.5)
I've plotted the above with histf but barwidth exceeding 1.0 is also possible with bar.

댓글을 달려면 로그인하십시오.


Chad Greene
Chad Greene 2014년 8월 14일
Or histf.

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by