how to use plt.xticks () to show dates (in days) in python?

2

I have the problem that I put the date on the x axis but it only gets in one part like the image together all day to the left

the data is for the whole year and I want it to show days or months  


plt.title("sacramento")
plt.xlabel("crimenes ")
plt.ylabel("indice de crimen ")

plt.xticks(range(100),fechas,size = 'small',color = 'b',rotation = 45)

for distrito,  filas in grupos.items():
    lista = [fila[9] for fila in filas]
    promedio = [sum(lista[:i+1])/float(i+1) for i in range(len(lista)-1)]
    plt.plot(promedio ,label = "distrito"+ str(distrito))

plt.legend()
plt.show()

an example fechas = [1/04/06 00:00,1/05/06 00:02,2/06/06 2:00]

fechas has a size 7857

    
asked by Luis Alberto Acosta 23.08.2017 в 20:38
source

0 answers