0
I have 1 table with 2 lists as for example the following ones , where the first one contains dates in the YYYYMMDD format and the second one contains the number of times a crime happened that day.
tuplo= (['20160130', '20160230', '20160330', '20160430', '20160530', '20160730'] [1, 2, 2, 2, 1, 1])
What I intend to do is a function that shows a graph with the number of crimes that occurred each day, and abscissas correspond to the years and ordered to the number of crimes.
def fazer_grafico(tuplo):
x = list()
for anos in tuplo[0]:
x.append(anos[:4])
# x é uma lista só com os anos
x_tmp = range(0, len(x), len(x)/len(set(x)))
y= grafico[1]
pylab.plot(range(len(x)), y)
x= sorted(set(x))
x.append(" ")
pylab.xticks(x_tmp,sorted(set(y)))
The function is doing the correct chart however it does only one thing that is my doubt, what I can do and then change in my code so that the abscissas in this case the x , take into account the years with 365 and 366 days , because supposedly with 365 the axis width will be smaller and with 366 will be bigger