[Solved] How to draw a histogram from existing bin values


Since you already have binned data, just use pyplot.errorbar or add yerr kwarg to bar plot

from matplotlib import pyplot as plt

plt.errorbar(
    [n/len(bins) for n, x in enumerate(bins)],
    [x[0][0] for x in bins],
    yerr = [x[0][1]**0.5 for x in bins],
    marker="_", fmt=".")

plt.bar(
    [n/len(bins) for n, x in enumerate(bins)],
    [x[0][0] for x in bins],
    yerr = [x[0][1]**0.5 for x in bins],
    width=1/80)

plt.errorbar
plt.bar(x, y, width, **yerr**

2

solved How to draw a histogram from existing bin values