Skip to content

Commit

Permalink
Group panel selection together
Browse files Browse the repository at this point in the history
  • Loading branch information
cschwan committed Sep 25, 2024
1 parent fa85e33 commit 24b97b8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 36 deletions.
42 changes: 14 additions & 28 deletions pineappl_cli/src/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@
xlog = False
ylog = False
scales = 1
enable_int = False
enable_abs = False
enable_rel_ewonoff = False
enable_abs_pdfs = False
enable_ratio_pdf = False
enable_double_ratio_pdf = False
enable_rel_pdfunc = False
enable_rel_pdfpull = False
plot_panels = {
"plot_int": False,
"plot_abs": False,
"plot_rel_ewonoff": False,
"plot_abs_pdfs": False,
"plot_ratio_pdf": False,
"plot_double_ratio_pdf": False,
"plot_rel_pdfunc": False,
"plot_rel_pdfpull": False,
}
output = ""
data = {}
metadata = {}
Expand Down Expand Up @@ -85,29 +87,13 @@


def main():
panels = []
if enable_int:
panels.append(plot_int)
if enable_abs:
panels.append(plot_abs)
if enable_rel_ewonoff:
panels.append(plot_rel_ewonoff)
if enable_abs_pdfs:
panels.append(plot_abs_pdfs)
if enable_ratio_pdf:
panels.append(plot_ratio_pdf)
if enable_double_ratio_pdf:
panels.append(plot_double_ratio_pdf)
if enable_rel_pdfunc:
panels.append(plot_rel_pdfunc)
if enable_rel_pdfpull:
panels.append(plot_rel_pdfpull)
panels = [globals()[panel] for panel, enabled in plot_panels.items() if enabled]

mpl.rcParams.update(stylesheet)
if enable_abs:
plt.rc("figure", figsize=(6.4, 2.4 * len(panels)))
if enable_int:
if len(panels) == 1:
plt.rc("figure", figsize=(4.2, 2.6))
else:
plt.rc("figure", figsize=(6.4, 2.4 * len(panels)))

for index, kwargs in enumerate(data):
figure, axes = plt.subplots(len(panels), 1, sharex=True, squeeze=False)
Expand Down
18 changes: 10 additions & 8 deletions pineappl_cli/src/plot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,14 +531,16 @@ ylabel = r\"{ylabel}\"
xlog = {xlog}
ylog = {ylog}
scales = {scales}
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}
plot_panels = {{
\"plot_int\": {enable_int},
\"plot_abs\": {enable_abs},
\"plot_rel_ewonoff\": {enable_rel_ewonoff},
\"plot_abs_pdfs\": {enable_abs_pdfs},
\"plot_ratio_pdf\": {enable_ratio_pdf},
\"plot_double_ratio_pdf\": {enable_double_ratio_pdf},
\"plot_rel_pdfunc\": {enable_rel_pdfunc},
\"plot_rel_pdfpull\": {enable_rel_pdfpull},
}}
output = r\"{output}\"",
enable_int = map_bool(enable_int),
enable_abs = map_bool(enable_abs),
Expand Down

0 comments on commit 24b97b8

Please sign in to comment.