This is clearly because the bin edges of your resulting histogram are not just even numbers 0,2,4....22.
To get the desired result, simply make use of the bins=
argument and, i.e., :
plt.hist(YOUR_DATA,bins=arange(0,24,2)) #for bin edge 0,2,4...,22, as in your figure.