import numpy as np import matplotlib.pyplot as plt evt = np.load('dimuon.npy') xmin, xmax, xbinwidth = 2.6, 3.6, 0.01 vy,edges = np.histogram(evt, bins=100, range=(xmin,xmax)) vx = 0.5*(edges[1:]+edges[:-1]) vyerr = vy**0.5 fig = plt.figure(figsize=(6,6), dpi=80) plt.plot([xmin,xmax],[0.,0.],c='black',lw=2) plt.errorbar(vx, vy, yerr = vyerr, fmt = '.') plt.grid() plt.show()