I need to create a graph where the x axis is dates and the y axis is the frequency of a certain event on that day. My issues are plotting with plt.bar() is that as I have values for every day over 8 years, the x axis has far too many labels to be legible. How do I change it so it only shows the years rather than having labels for every day?
I've tried this
# data == dict, keys == 'yyyy-mm-dd'
plt.bar(data.keys(), data.values())
ticks = []
for key in data.keys():
ticks.append(key[0:4]) # Gets only years.
ticks = list(set(ticks)) # Get rid of duplicates.
plt.xticks(ticks)
plt.show()
But the new xticks bunch together at the end on top of one another.