From cc9eda109677572de77fba4e2404f0d0732d4c18 Mon Sep 17 00:00:00 2001 From: Nikolai Hartmann <Nikolai.Hartmann@physik.uni-muenchen.de> Date: Mon, 27 Aug 2018 14:47:04 +0200 Subject: [PATCH] fixing lumifactor support for overlay_ROC --- compare.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/compare.py b/compare.py index 2681dca..cfe29df 100755 --- a/compare.py +++ b/compare.py @@ -21,6 +21,7 @@ def overlay_ROC(filename, *projects, **kwargs): plot_thresholds = kwargs.pop("plot_thresholds", False) threshold_log = kwargs.pop("threshold_log", True) lumifactor = kwargs.pop("lumifactor", None) + tight_layout = kwargs.pop("tight_layout", False) if kwargs: raise KeyError("Unknown kwargs: {}".format(kwargs)) @@ -57,9 +58,9 @@ def overlay_ROC(filename, *projects, **kwargs): if lumifactor is not None: sumw_b = p.w_test[p.y_test==0].sum()*lumifactor sumw_s = p.w_test[p.y_test==1].sum()*lumifactor - ax_abs_b.plot(tpr, (1.-fpr)*sumw_b, "r--", alpha=0.5) + ax_abs_b.plot(tpr, (1.-fpr)*sumw_b, alpha=0) ax_abs_b.invert_yaxis() - ax_abs_s.plot(tpr*sumw_s, fpr, "g--", alpha=0.5) + ax_abs_s.plot(tpr*sumw_s, fpr, alpha=0) if xlim is not None: ax.set_xlim(*xlim) @@ -79,7 +80,7 @@ def overlay_ROC(filename, *projects, **kwargs): ax.set_title('Receiver operating characteristic') ax.set_ylabel("Background rejection") ax.set_xlabel("Signal efficiency") - if plot_thresholds: + if plot_thresholds or tight_layout: # to fit right y-axis description fig.tight_layout() return save_show(plt, fig, filename) -- GitLab