From 795372d8178d9b0ca6dd9e7ffa5ca10ed13bdd5b Mon Sep 17 00:00:00 2001
From: Nikolai Hartmann <Nikolai.Hartmann@physik.uni-muenchen.de>
Date: Thu, 15 Nov 2018 15:57:14 +0100
Subject: [PATCH] fix plot_input for inputs with a single value

---
 toolkit.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/toolkit.py b/toolkit.py
index a97a846..164b558 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)
 
-- 
GitLab