1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| import matplotlib.pyplot as plt
#bigT=[titre1, [abscisse 1],[ ordonnée1],titre2, [abscisse 2],[ ordonnée2]] tableau contenant les données des graphiques
BigT=['RED-G-75139 Body Die 7-08 Remington', ['01/01/2017', '03/01/2018', '09/05/2018', '15/06/2018', '20/09/2018', '11/10/2018', '18/10/2019', '14/11/2019', '10/03/2020', '14/04/2020', '19/05/2020', '30/07/2020', '08/12/2020'], [2, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0], 'RED-G-75153 Body Die .300 Win. Mag.', ['01/01/2017', '18/01/2017', '17/02/2017', '04/01/2019', '20/02/2019', '05/05/2020', '30/07/2020', '14/08/2020', '25/11/2020'], [1, 0, 1, 0, 1, 0, 1, 0, 1]]
nbre_de_courbe=int(len(BigT)/3)
for x in range(1,nbre_de_courbe+1):
plt.figure(figsize=(20,6))
abscisse=[]
for y in range(0,len(BigT[x*3-2])):
abscisse.append(y)
plt.plot(abscisse,BigT[x*3-1],"r",linewidth=1)
plt.xticks(fontsize = 8, rotation=45)
plt.xticks(abscisse,BigT[x*3-2])
plt.title(BigT[x*3-3])
plt.grid(linewidth=0.5) # grille et son épaisseur
fig1 = plt.gcf()
plt.show()
nomfichier="fichier"+str(x)+".pdf"
fig1.savefig(nomfichier) |
Partager