I have a file with a list of dates, formatted as "YYYY-MM-DD". The data is well-structured, so I don't need to be concerned with outliers. I'm using a defaultdict
to get the count of occurrences of each date. For example, the dictionary may look like:
2015-01-01 : 5
2015-01-15 : 3
2015-02-03 : 4
2015-02-04 : 2
I'd like to plot the counts as a histogram, where the spacing along the x-axis is commensurate with the dates. If there is a large gap between dates, I would like the bars to be spaced accordingly. Is this possible?
I've found a very similar question, How to plot data against specific dates on the x-axis using matplotlib, but this uses a line graph instead of bars, like a histogram.