For these kind of problems you may set x axis as date field. This will fill in na dates and leave gaps accordingly which is helpful to analyze time series and things like monthly spending and it's quite easy to do. Following code snipper should help.
ax = plt.subplot(111)
ax.bar(x, y, width=10)
ax.xaxis_date()
plt.show()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.