1

I have a histogram plot. I want to print the frequency of the bins on the plot.

An example is shown here.

enter image description here

My present code is:

df = 
index                      Data
2019-01-09 13:20:17     79.536248
2019-01-09 14:00:17    137.362250
2019-01-09 14:40:17    214.963727
2019-01-09 15:20:17     57.323960
2019-01-09 16:00:17    144.694933
2019-01-09 16:40:17    278.393733
2019-01-10 07:35:22      7.356864
2019-01-10 08:15:17     33.682382
2019-01-10 08:55:17     31.229357
2019-01-10 09:35:17     27.168540
2019-01-10 10:15:17     22.131650
2019-01-10 10:55:17     12.528640
2019-01-10 11:35:17     11.980847

(poa_list, bins, patches)=plt.hist(df['Data'],bins=np.arange(0, 500, 25))
plt.show()
Mainland
  • 4,110
  • 3
  • 25
  • 56
  • Please, share your code entirely, including your DataFrame. Thanks. – sentence Jan 18 '20 at 17:39
  • 1
    Have you tried to adapt any of the [annotation examples](https://matplotlib.org/gallery/index.html#text-labels-and-annotations) in the Matplotlib Gallery? … [Grouped bar chart with labels](https://matplotlib.org/gallery/lines_bars_and_markers/barchart.html#grouped-bar-chart-with-labels) – wwii Jan 18 '20 at 17:45
  • 2
    Does this answer your question? [Adding value labels on a matplotlib bar chart](https://stackoverflow.com/questions/28931224/adding-value-labels-on-a-matplotlib-bar-chart) - the bars in a bar chart are patches (matplotlib.patches.Patch ), same for a histogram so this Q&A should suffice. – wwii Jan 18 '20 at 18:01
  • @sentence I did add some sample data. Thanks – Mainland Jan 18 '20 at 18:02

0 Answers0