How does one plot a histogram from the histogram counts?

조회 수: 13 (최근 30일)
Brando Miranda
Brando Miranda 2017년 3월 27일
댓글: the cyclist 2017년 3월 28일
I have produced an array of counts, specifically produced with:
histcounts
the reason I do this is because storing the actual data is way to expensive in terms of storage. So on the fly I update my histcount. Now that I have them, how do I plot the histogram?
----
demo code:
W_hist_counts = zeros(1,D);
for i=2:iter+1
W = get_vector_we_want_stats(W)
%
W_hist_counts = W_hist_counts + histcounts(W,nbins);
end
----

답변 (2개)

the cyclist
the cyclist 2017년 3월 27일
The most straightforward way is probably to use the bar command.
  댓글 수: 4
Brando Miranda
Brando Miranda 2017년 3월 27일
also, bar doesn't accept normalization options. I know histcounts does but that forces me to have all the data before I feed it to histcounts, which I don't have because I am in the real of big data. I can produce statistics (like counts) on the fly but not store the whole thing in matlab.
the cyclist
the cyclist 2017년 3월 28일
I assume you want to normalize to an overall sum of 1. You should just be able to plot
W_hist_counts/sum(W_hist_counts)
to normalize, right?

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


Image Analyst
Image Analyst 2017년 3월 27일
histogram() can plot the histogram data (counts vs values) if you pass in the counts and values instead of the data. Otherwise you can do it manually with bar().

카테고리

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