I am working with a table that indicates the Number of the day, the hour of the day and a number of visits
And I want to create a bar graph that indicates the number of visits per hour (like the one in the image)
But how can I also indicate the hours in each bar? Something similar to what I have done with paint, but at all times, of course.
You can also use
matplotlib.pyplot.text
ormatplotlib.pyplot.annotate
to add the text you want above each column.I'm assuming your data is in a Pandas DataFrame, so you can use it
pandas.DataFrame.plot.bar
to make it easy to create the chart from it, although the idea is the same if usedmatplotlib.pyplot.bar
directly.Since you apparently represent the time as an integer, I've simply used string literal formatting
f"{visitsPerDay['Hora'][i]}:00"
to assign the corresponding string to each slash, if you're using Python < 3.6 you can use"{}:00".format(visitsPerDay['Hora'][i])
.