I have created a histogram using matplotlib of my experimental data, which consists of the value measured and the weight. Using the weights argument of plt.hist it is no problem weighting together the events, but when I look at options for errorbars none seem to take event weights into account. There are solutions to this problem where Poisson errors or the same error is used everywhere, like this one, but that does not solve my problem.
The error of one bin should mathematically be calculated as err(bin) = sqrt( sum {w_i^2} )
where w_i are the individual weights of the events that belong in that bin.
A simplified example of my histogram is given below.
import matplotlib.pyplot as plt
data=[1,8,5,4,1,10,8,3,6,7]
weights=[1.3,0.2,0.01,0.9,0.4,1.05,0.6,0.6,0.8,1.8]
plt.hist(data, bins = [0.0,2.5,5.0,7.5,10.0], weights=weights)
plt.show()