how can I present histogram as line plot

Hi,
I want to present histogram as the picture added, does anyone knows what is the commend?

 채택된 답변

Star Strider
Star Strider 2020년 5월 24일

0 개 추천

Set DisplayStyle to stairs.

댓글 수: 5

sani
sani 2020년 5월 24일
I did it, for some reason it not working
figure(1);
histogram(scint_single,'DisplayStyle','stairs','BinWidth',0.1);
set(gca,'YScale','log')
plot:
It is working.
It is doing exactly what you asked it to do. The histogram data appear to be going to 0 between the other bins in that plot.
This produces a result similar to what you originally described as wanting it to look like:
x = rand(1, 100);
histogram(x, 10, 'DisplayStyle','stairs')
Perhaps requesting fewer bins will give you the result that you originally described.
.
Zoom in. You've got bins of width 0.1 spanning from (roughly) 0 to 3500 on the X axis. That means you have roughly 35000 bins. What's the horizontal resolution of your computer screen?
My guess is that some of those bins contain data and some are empty. You've probably got something that looks like this but with much narrower bins and many more bins.
histogram('BinCounts', repmat([5 0], 1, 10), ...
'BinEdges', 0:20, ...
'DisplayStyle', 'stairs')
ylim([-1 6])
To paraphrase Roy Scheider in the movie Jaws, I think you're gonna need bigger (wider) bins. Or a bigger (higher resolution) screen.
sani
sani 2020년 5월 24일
yes you are right, it was the bin number, thanks!
Star Strider
Star Strider 2020년 5월 24일
As always, my (our) pleasure!
Steven — Thank you!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Histograms에 대해 자세히 알아보기

태그

질문:

2020년 5월 24일

댓글:

2020년 5월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by