I'm trying to plot a horizontal bar chart in python of the following data:
Using the following code:
import matplotlib.pyplot as plt
plt.barh(subset['sources'], width=subset['repairDate'], left=subset['appearanceDate'])
but the output gives me the dates in the x-axis as some sort of integer.
I tried to use a custom date formatter to maybe fix that but I honestly can't tell what went on behind the scenes there, it just multiplied the number of xticks dramatically and the labels themselves seem to still be integers:
fig, ax = plt.subplots(1, 1)
ax.barh(subset['sources'], width=subset['repairDate'], left=subset['appearanceDate'])
ax.xaxis.set_major_locator(mdates.YearLocator(1))
ax.xaxis.set_major_formatter(mdates.ConciseDateFormatter(ax.xaxis.get_major_locator()))
ax.set_xticklabels(ax.get_xticks(), rotation=90);