0

I have the following data frame:

week          person_counts
2023-01-23    777
2023-01-30    800
2023-02-06    890
2023-02-13    766
2023-02-20    789

How can I plot this with labels on top of each bar?

I have the following code: I see solutions online but most of them are solutions when plotting using the pandas function or with seaborn. How can i do this with just a matplotlib bar() plot?

fig, ax = plt.subplots(figsize = (15,6))
ax.set_ylabel('Person Count')
ax.set_title('Persons')

ax.xaxis.set.major_formatter(mdates.DateFormatter('%m/%d/%y')
ax.bar(df.TimeStamp, df.person_counts, width = 5)

plt.xticks(df.TimeStamp)
plt.show()
Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
Eisen
  • 1,697
  • 9
  • 27

0 Answers0