From 052ccbdd2c59798c8cafaaeca5f05c9c736028f5 Mon Sep 17 00:00:00 2001
From: Nikolai <osterei33@gmx.de>
Date: Wed, 22 Aug 2018 09:34:32 +0200
Subject: [PATCH] switch plotting to save_show

---
 plotting.py | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/plotting.py b/plotting.py
index db4df95..be9057e 100644
--- a/plotting.py
+++ b/plotting.py
@@ -60,8 +60,7 @@ def plot_NN_vs_var_1D(plotname, means, scorefun, var_index, var_range, var_label
     if var_label is not None:
         ax.set_xlabel(var_label)
     ax.set_ylabel("NN output")
-    fig.savefig(plotname)
-    plt.close(fig)
+    save_show(plt, fig, plotname)
 
 
 def plot_NN_vs_var_2D(plotname, means,
@@ -134,8 +133,7 @@ def plot_NN_vs_var_2D(plotname, means,
         ax.set_xlabel(varx_label)
     if vary_label is not None:
         ax.set_ylabel(vary_label)
-    fig.savefig(plotname)
-    plt.close(fig)
+    save_show(plt, fig, plotname)
 
 
 def plot_NN_vs_var_2D_all(plotname, model, means,
@@ -233,8 +231,7 @@ def plot_NN_vs_var_2D_all(plotname, model, means,
     cb.ax.xaxis.set_ticks_position('top')
     cb.ax.xaxis.set_label_position('top')
 
-    fig.savefig(plotname, bbox_inches='tight')
-    plt.close(fig)
+    save_show(plt, fig, plotname, bbox_inches='tight')
 
 
 def plot_hist_2D(plotname, xedges, yedges, hist, varx_label=None, vary_label=None, log=False, zlabel="# of events"):
@@ -252,9 +249,7 @@ def plot_hist_2D(plotname, xedges, yedges, hist, varx_label=None, vary_label=Non
     cbar.set_label(zlabel)
     ax.set_ylabel(vary_label)
     ax.set_xlabel(varx_label)
-    fig.savefig(plotname)
-
-    plt.close(fig)
+    save_show(plt, fig, plotname)
 
 
 def plot_hist_2D_events(plotname, valsx, valsy, nbinsx, xmin, xmax, nbinsy, ymin, ymax,
-- 
GitLab