I'm using matplotlib in Python and I made a histogram with bars. Now when the histogram appears only the multiples of 5 appear on the x-axis and the multiples of 1000 appear on the y-axis. For the y-axis it's no problem at all but for the x-axis I want the interval to be 1 instead of 5 because I use 1 bar per hour. How can I achieve this?
Thanks in advance.
def plotHistogramTickets():
hours_NumbersSold = dict()
for i in range(24):
hours_NumbersSold[i]=0
soldTickets = db.getSoldTickets()
for ticket in soldTickets:
hourSold = ticket.timeBought.hour
hours_NumbersSold[hourSold]+=1
for k,v in hours_NumbersSold.iteritems():
plt.bar(k,v,1,0)
plt.xlabel("Hours")
plt.ylabel("Numbers of tickets sold")
plt.title("Numbers of tickets sold per hour")
plt.grid(True)
plt.show()