From a20ed8028ed314382228ee1911fcfd14302635ed Mon Sep 17 00:00:00 2001 From: Christopher Schwan Date: Thu, 15 Aug 2024 12:24:24 +0200 Subject: [PATCH] Allow more fine-grained selection of panels --- pineappl_cli/src/plot.py | 20 ++++++++++---------- pineappl_cli/src/plot.rs | 25 ++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/pineappl_cli/src/plot.py b/pineappl_cli/src/plot.py index 15230d9c..7c1b926f 100644 --- a/pineappl_cli/src/plot.py +++ b/pineappl_cli/src/plot.py @@ -72,19 +72,19 @@ def main(): panels = [ - {inte}plot_int, - {nint}plot_abs, - {nint}plot_rel_ewonoff, - {nconvs}plot_abs_pdfs, - {nconvs}plot_ratio_pdf, - {nconvs}plot_double_ratio_pdf, - {nconvs}plot_rel_pdfunc, - {nconvs}plot_rel_pdfpull, + {enable_int}plot_int, + {enable_abs}plot_abs, + {enable_rel_ewonoff}plot_rel_ewonoff, + {enable_abs_pdfs}plot_abs_pdfs, + {enable_ratio_pdf}plot_ratio_pdf, + {enable_double_ratio_pdf}plot_double_ratio_pdf, + {enable_rel_pdfunc}plot_rel_pdfunc, + {enable_rel_pdfpull}plot_rel_pdfpull, ] mpl.rcParams.update(stylesheet) - {nint}plt.rc("figure", figsize=(6.4, 2.4 * len(panels))) - {inte}plt.rc("figure", figsize=(4.2, 2.6)) + {enable_abs}plt.rc("figure", figsize=(6.4, 2.4 * len(panels))) + {enable_int}plt.rc("figure", figsize=(4.2, 2.6)) data_slices = data() diff --git a/pineappl_cli/src/plot.rs b/pineappl_cli/src/plot.rs index a2c4c975..fad706cf 100644 --- a/pineappl_cli/src/plot.rs +++ b/pineappl_cli/src/plot.rs @@ -513,11 +513,30 @@ impl Subcommand for Opts { let bins = grid.bin_info().bins(); let nconvs = self.conv_funs.len(); + let enable_int = if bins == 1 { "" } else { "# " }; + let enable_abs = if bins == 1 { "# " } else { "" }; + // TODO: only enable if there are EW corrections + let enable_rel_ewonoff = enable_abs; + let enable_abs_pdfs = if nconvs == 1 || bins == 1 { "# " } else { "" }; + let enable_ratio_pdf = enable_abs_pdfs; + let enable_double_ratio_pdf = enable_abs_pdfs; + let enable_rel_pdfunc = if nconvs == 1 || bins == 1 || self.no_conv_fun_unc { + "# " + } else { + "" + }; + let enable_rel_pdfpull = enable_rel_pdfunc; + print!( include_str!("plot.py"), - inte = if bins == 1 { "" } else { "# " }, - nint = if bins == 1 { "# " } else { "" }, - nconvs = if nconvs == 1 || bins == 1 { "# " } else { "" }, + enable_int = enable_int, + enable_abs = enable_abs, + enable_rel_ewonoff = enable_rel_ewonoff, + enable_abs_pdfs = enable_abs_pdfs, + enable_ratio_pdf = enable_ratio_pdf, + enable_double_ratio_pdf = enable_double_ratio_pdf, + enable_rel_pdfunc = enable_rel_pdfunc, + enable_rel_pdfpull = enable_rel_pdfpull, xlabel = xlabel, ylabel = ylabel, xlog = xlog,