From 19f1b4fd70caa4d6efe1043fa5304c7d0d056e2e Mon Sep 17 00:00:00 2001
From: Klaus Rabbertz <klaus.rabbertz@cern.ch>
Date: Tue, 18 Jun 2024 03:50:15 +0200
Subject: [PATCH] Corrections for newer matplotlib

---
 tools/plotting/fastnnlo_pdfunc.py   |  9 +++++----
 tools/plotting/fastnnlo_scaleunc.py | 11 +++++------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/tools/plotting/fastnnlo_pdfunc.py b/tools/plotting/fastnnlo_pdfunc.py
index 363465d9..526ed73d 100755
--- a/tools/plotting/fastnnlo_pdfunc.py
+++ b/tools/plotting/fastnnlo_pdfunc.py
@@ -179,8 +179,10 @@ def plotting(x_axis, xmin, xmax, xs_all, rel_pdf_unc, abs_pdf_unc, dxsr_cn, nost
         #                        else: ax1.set_xscale('linear')
         #                        if logy: ax1.set_yscale('log', nonposy='clip')
         #                        else: ax1.set_yscale('linear')
-        ax1.set_xscale('log', nonposx='clip') # Will become nonpositive= in matplotlib 3.3.x
-        ax1.set_yscale('log', nonposy='clip') # Will become nonpositive= in matplotlib 3.3.x
+        #        ax1.set_xscale('log', nonposx='clip') # Will become nonpositive= in matplotlib 3.3.x
+        #        ax1.set_yscale('log', nonposy='clip') # Will become nonpositive= in matplotlib 3.3.x
+        ax1.set_xscale('log', nonpositive='clip')
+        ax1.set_yscale('log', nonpositive='clip')
         # Set label on x axis on coupled axis from lower plot
         #        ax1.set_xlabel(r'%s' %xlabel, horizontalalignment='right', x=1.0, verticalalignment='top', y=1.0)
         ax1.set_ylabel(r'%s' % ylabel, horizontalalignment='right', x=1.0,
@@ -620,8 +622,7 @@ def main():
                 xs_list_tmp.append(fnlo.GetCrossSection())
 
                 ### Get PDF uncertainties ###
-                rel_pdf_unc_item = np.array(fnlo.GetPDFUncertaintyVec(
-                    fastnlo.kLHAPDF6))  # Now calculated for order n
+                rel_pdf_unc_item = np.array(fnlo.GetPDFUncertaintyVec(fastnlo.kLHAPDF6)) # Now calculated for order n
                 rel_unc_list_tmp.append(rel_pdf_unc_item)
                 if verb:
                     print('[fastnnlo_pdfunc]: \n')
diff --git a/tools/plotting/fastnnlo_scaleunc.py b/tools/plotting/fastnnlo_scaleunc.py
index 3f43ab3d..6b9f209e 100755
--- a/tools/plotting/fastnnlo_scaleunc.py
+++ b/tools/plotting/fastnnlo_scaleunc.py
@@ -154,10 +154,10 @@ def plotting(x_axis, xmin, xmax, xs_all, rel_scale_unc, abs_scale_unc, dxsr_cn,
     #    axfmt = LogFormatter(labelOnlyBase=False, minor_thresholds=(2, 0.4))
     #    ax1.get_xaxis().set_minor_formatter(axfmt)
     #        ax1.get_xaxis().set_minor_formatter(NullFormatter())
-    #    ax1.set_xscale('log', nonposx='clip')
-    #    ax1.set_yscale('log', nonposy='clip')
-    ax1.set_xscale('log', nonpositive='clip') # Will become nonpositive= in matplotlib 3.3.x
-    ax1.set_yscale('log', nonpositive='clip') # Will become nonpositive= in matplotlib 3.3.x
+    #    ax1.set_xscale('log', nonposx='clip') # Will become nonpositive= in matplotlib 3.3.x
+    #    ax1.set_yscale('log', nonposy='clip') # Will become nonpositive= in matplotlib 3.3.x
+    ax1.set_xscale('log', nonpositive='clip')
+    ax1.set_yscale('log', nonpositive='clip')
     # Set label on x axis on coupled axis from lower plot
     #        ax1.set_xlabel(r'%s' %xlabel, horizontalalignment='right', x=1.0, verticalalignment='top', y=1.0)
     ax1.set_ylabel(r'%s' % ylabel, horizontalalignment='right', x=1.0,
@@ -593,8 +593,7 @@ def main():
             # Up to NLO, it is possible to use HOPPET with fixed-scale tables
             #                fnlo.UseHoppetScaleVariations(True)
             # Calculate this already for all accessible orders in any case
-            rel_scale_unc_item = np.array(
-                fnlo.GetScaleUncertaintyVec(scale_var_type))
+            rel_scale_unc_item = np.array(fnlo.GetScaleUncertaintyVec(scale_var_type))
             rel_unc_list.append(rel_scale_unc_item)
             if verb:
                 print('[fastnnlo_scaleunc]: \n')
-- 
GitLab