How I can plot this bar graph
조회 수: 1 (최근 30일)
이전 댓글 표시
This bar graph shows on y axis the time and on x axis the number of points.
I want to plot this bar graph as such that it gives accumulated value of 0.8 entries and 0.9 entries like histogram do. Mean its thickness remain same but its height increases with accumulation of entries. for 0.8 it shows height 10 and for 0.9 it shows height 6.
Actually in my problem set 0.8 and 0.9 are the time axis and this 10 and 6 represents the number of data packet generated in that time instant. like 0.8 comes first so at 0.8 time instant 10 data packets generated and at 0.9 time instant 6 data packet and so on..
I hope this will help in understanding what I want to do. I just want to work like histogram using bar plot. so I want to automatically plot the data set using bar graph.
댓글 수: 0
답변 (1개)
Stephen23
2016년 2월 29일
편집: Stephen23
2016년 2월 29일
If the values were integer then it would be possible using unique, but because you have floating-point values I would recommend that you use John D'Errico's very neat FEX submission consolidator:
tol = 0.05;
Y = [0.8,0.8,0.8,0.8,0.9,0.8,0.9,0.9,0.9,0.8,0.8,0.9,0.8,0.9,0.8,0.8,0.9];
[~,ycon,ind] = consolidator(Y,[],'count',tol);
bar(1:numel(ind),ycon(ind))
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Bar Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!