diff --git a/toolkit.py b/toolkit.py index a97a84671840ffb675f8962dab6784cc77f004c4..164b558f71872e9668f33b07cd0280634a93aa66 100755 --- a/toolkit.py +++ b/toolkit.py @@ -1259,7 +1259,10 @@ class ClassificationProject(object): centers_sig, hist_sig, _ = self.get_bin_centered_hist(sig, bins=bins, range=plot_range, weights=sig_weights) centers_bkg, hist_bkg, _ = self.get_bin_centered_hist(bkg, bins=bins, range=plot_range, weights=bkg_weights) - width = centers_sig[1]-centers_sig[0] + if bins > 1: + width = centers_sig[1]-centers_sig[0] + else: + width = 1. ax.bar(centers_bkg, hist_bkg, color="b", alpha=0.5, width=width) ax.bar(centers_sig, hist_sig, color="r", alpha=0.5, width=width)