Я новичок в Python и программировании в целом.
Я пытаюсь отобразить значение для каждой недели на гистограмме.Я хотел бы иметь отметки на оси x под каждой нанесенной точкой, чтобы было легко понять связь между значениями и датами.
У меня есть Pandas dataframe(df_clean)
, которая выглядит следующим образом (извините за французский столбецимя):
Data columns (total 20 columns):
Statut 23467 non-null object
P.O 23467 non-null object
Fournisseur 23467 non-null object
Date Comm. 23467 non-null object
Date Annul. 23466 non-null object
Date TPA 23467 non-null object
Qté Comm. 23467 non-null float64
Courant comm. 23467 non-null float64
Cout comm. 23467 non-null float64
Qté recue 23467 non-null float64
Courant recue 23467 non-null float64
Cout recue 23467 non-null float64
Qté souff. 23467 non-null float64
Courant souff. 23467 non-null float64
Cout souff. 23467 non-null float64
% recue 23467 non-null float64
% MB 23467 non-null float64
Premier jour sem. TPA 23467 non-null object
Year TPA 23467 non-null int64
Jour de la semaine TPA 23467 non-null object
Моя цель - построить сумму df_clean["Cout comm."]
для каждого df_clean["Premier jour sem. TPA"]
.Я хотел бы, чтобы это выглядело следующим образом:

Вот код до настоящего времени
#Group by first day of week
sem_tpa_group = df_clean.groupby("Premier jour sem. TPA").agg("sum")
sem_tpa_group.reset_index(inplace=True)
#Limit the amount of week to show
sem_tpa_group = sem_tpa_group[sem_tpa_group["Premier jour sem. TPA"] > date.today()]
#Create graph
fig = plt.figure()
ax = plt.subplot(111)
plt.plot(sem_tpa_group["Premier jour sem. TPA"], sem_tpa_group["Cout comm."],'o-',label='Ord. cost')
plt.plot(sem_tpa_group["Premier jour sem. TPA"], sem_tpa_group["Cout recue"],'o-',label='Rec. cost')
plt.legend(loc=1)
plt.ylabel('Cost')
plt.xlabel('Week date')
plt.grid()
plt.show()
Результат таков:

Кто-нибудь сможет рассказать мне, как получить информацию о тиках для каждой построенной точки на оси x?
Я пытался plt.xticks()
безрезультатно, хотя я не уверен, что использовал его правильно.
Большое спасибо за все