I need some help with my Matplotlib graph. The project can be viewed here (currently working under the new-graph branch).
As a summary of what this project does:
- Download two CSV files (UK COVID-19 cases and UK COVID-19 deaths)
- Parse the CSV files as a Pandas data-frame to only have the columns with the date and the cumulative values
- Plot these two sets of data on one graph using Matplotlib bar graph
My issue is that Matplotlib is not automatically spacing out the X-axis values (the dates). I'm not sure if it's because Matplotlib does not recognise them as dates or some other error I've made. Here is what the graph currently looks like.
EDIT: Sorry I forgot to add the code to the question. Here it is...
import matplotlib.pyplot as plt
def plot(cases,deaths):
#cases.plot(x='Specimen date',y='Cumulative lab-confirmed cases',color='green')
#deaths.plot(x='Reporting date',y='Cumulative deaths',color='red')
plt.figure("Cumulative deaths and cases")
ax = plt.gca()
cases.plot(kind='bar', x='Specimen date', y='Cumulative lab-confirmed cases',ax=ax, color='green')
deaths.plot(kind='bar', x='Reporting date', y='Cumulative deaths', ax=ax, color='red')
plt.show()