![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/173096/image.png)
How I can plot this bar graph
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
This bar graph shows on y axis the time and on x axis the number of points.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/156150/image.png)
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 commentaires
Réponses (1)
Stephen23
le 29 Fév 2016
Modifié(e) : Stephen23
le 29 Fév 2016
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))
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/173096/image.png)
0 commentaires
Voir également
Catégories
En savoir plus sur Bar Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!