From your plot and initial code, I could understand that you already have a bit and frequency values in 2 vectors x and y. In this case, you simply plot the histogram of these values, unlike the histogram, using the plt.hist command. You can do the following:
import matplotlib.pyplot as plt
x = (1,2,3,4,5)
y = (1,2,3,4,5)
plt.bar(x,y,align='center')
plt.xlabel('Bins')
plt.ylabel('Frequency')
for i in range(len(y)):
plt.hlines(y[i],0,x[i])
plt.show()

source
share