code for adding error bars to histograms