This is my data:
a3=pd.DataFrame({'OfficeName':['a','b','c','d','e','f','g','h'],
'Ratio': [0.1,0.15,0.2,0.3,0.2,0.25,0.1,0.4]})
and this is my code to draw a bar chart:
fig, ax = plt.subplots()
ind = np.arange(a3.loc[:,'OfficeName'].nunique()) # the x locations for the groups
width = 0.35 # the width of the bars
p1 = ax.bar(ind,a3.loc[:,'Ratio'],width)
ax.set_title('Ratio of refunds to purchases')
ax.set_xticklabels(a3.loc[:,'OfficeName'],ha='center')
#ax.set_xticklabels(['a','b','c','d','e','f','g','h'],ha='center')
ax.set_xlabel('x Group')
ax.set_ylabel('Ratio')
plt.show()
But, in my chart the first x label is missing:
I think this problem is not the same as Matplotlib: Move x-axis tick labels one position to left because I do not even need rotate the x labels.
Could anyone explain why this happens and how to fix it?