´how to plot bar graph with one set of data
2 次查看(过去 30 天)
显示 更早的评论
Hello, I have one column of data in that i have to make a plot the number of occurrence of same data in that column.for example w=(1,2,5,78,89,3,4,5,6,1,2,3,4,6,71,2,3,4,4,1,2,3,4,7,8,9,9) from this data i have to plot how many time 1 number is in this data and 2 number occurrence.
Please let me know how to solve it...
0 个评论
采纳的回答
Star Strider
2014-7-1
One way:
w=[1,2,5,78,89,3,4,5,6,1,2,3,4,6,71,2,3,4,4,1,2,3,4,7,8,9,9];
ctrs = [min(w):max(w)];
cnt = hist(w,ctrs);
out = [ctrs; cnt];
% fprintf(1,'\n\tNr\tFreq\n')
% fprintf(1,'\t%2d\t%4d\n', out)
figure(1)
bar(ctrs, cnt, 'r')
grid
xlabel('Number')
ylabel('Counts')
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!