I have made a histogram using 3 different pandas series. I wanted to label the groups of bars 1,2,and 3. I was unsuccessful in using xlabels to do this; technically it worked but the numbers 1,2,3 were not aligned properly with the bars.
I have decided to skip that and try annotating. Unfortunately, I figure out how to do it properly.
I tried using xlabels, unsuccessfully. Now I am trying annotation but I can't get more than one text to show on the graph.
Here is an example of what the data looks like Wr_Spr_Conv = [1,1,1,2,2,2,3,3,3,2,2,1,2,3...]
new2['Wr_Spr_Conv'].replace(0, pd.np.nan).dropna(inplace = True)
new2['Re_Spr_Conv'].replace(0, pd.np.nan).dropna(inplace = True)
new2['Ma_Spr_Conv'].replace(0, pd.np.nan).dropna(inplace = True)
plt.style.use('seaborn')
x_labels = [1,2,3]
fig, ax1 = plt.subplots(figsize=(10,10))
#ax1.spines['left'].set_position(('outward', 10))
#ax1.spines['bottom'].set_position(('outward', 10))
# Hide the right and top spines
ax1.spines['right'].set_visible(False)
ax1.spines['top'].set_visible(False)
ax1.spines['bottom'].set_visible(False)
ax1.spines['right'].set_visible(False)
nbins = 9
ax1.tick_params(bottom="off", top="off", left="off", right="off")
ax1.hist([new2['Wr_Spr_Conv'],new2['Re_Spr_Conv'],new2['Ma_Spr_Conv']],nbins)
#ax1.set_xticks(3)
#ax1.set_xticks(3)
#ax1.set_xlim(right =3)
#ax1.set_xlim(left=0)
# Only show ticks on the left and bottom spines
#ax1.yaxis.set_ticks_position('left')
#ax1.xaxis.set_ticks_position('bottom')
ax1.set_xticks(x_labels)
ax1.set_xlim(right=3) # adjust the right leaving left unchanged
ax1.set_xlim(left=1) # adjust the left leaving right unchanged
ax1.xaxis.set_major_locator(MaxNLocator(integer=True))
#ax1.annotate('Level 1',xy=(1,15))