Skip to content

Commit e54ab80

Browse files
committed
Remove and rename a few variable in the plot script
1 parent 5f3f866 commit e54ab80

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

pineappl_cli/src/plot.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -275,12 +275,11 @@ def main():
275275
plt.rc('ytick.major', width=0.5)
276276
plt.rc('ytick.minor', visible=True, width=0.5)
277277

278-
xaxis = '{xaxis}'
279-
xunit = '{xunit}'
280278
xlabel = r'{xlabel}'
281279
ylabel = r'{ylabel}'
280+
xlog = {xlog}
282281
ylog = {ylog}
283-
description = r'{description}'
282+
title = r'{title}'
284283

285284
data_slices = data()
286285

@@ -290,10 +289,10 @@ def main():
290289

291290
figure, axes = plt.subplots(len(panels), 1, sharex=True, squeeze=False)
292291

293-
if len(kwargs['x']) != 2 and xunit != '':
292+
if len(kwargs['x']) > 2 and xlog:
294293
axes[0, 0].set_xscale('log')
295294

296-
axes[ 0, 0].set_title(description)
295+
axes[ 0, 0].set_title(title)
297296
axes[-1, 0].set_xlabel(xlabel)
298297

299298
for plot, axis in zip(panels, axes[:, 0]):

pineappl_cli/src/plot.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,9 @@ impl Subcommand for Opts {
463463
format!(" [\\si{{{}}}]", yunit)
464464
}
465465
);
466+
let xlog = if xunit == "" { "False" } else { "True" };
466467
let ylog = if xlabel == "" { "True" } else { "False" };
467-
let description = key_values
468+
let title = key_values
468469
.get("description")
469470
.map(String::as_str)
470471
.unwrap_or("");
@@ -476,12 +477,11 @@ impl Subcommand for Opts {
476477
inte = if bins == 1 { "" } else { "#" },
477478
nint = if bins == 1 { "#" } else { "" },
478479
pdfs = if pdfs == 1 || bins == 1 { "#" } else { "" },
479-
xaxis = xaxis,
480-
xunit = xunit,
481480
xlabel = xlabel,
482481
ylabel = ylabel,
482+
xlog = xlog,
483483
ylog = ylog,
484-
description = description,
484+
title = title,
485485
output = output.to_str().unwrap(),
486486
data = data_string,
487487
metadata = format_metadata(&vector),

pineappl_cli/tests/plot.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,11 @@ def main():
295295
plt.rc('ytick.major', width=0.5)
296296
plt.rc('ytick.minor', visible=True, width=0.5)
297297
298-
xaxis = 'x1'
299-
xunit = ''
300298
xlabel = r'$\eta_{\bar{\ell}}$'
301299
ylabel = r'$\frac{\mathrm{d}\sigma}{\mathrm{d}\eta_{\bar{\ell}}}$ [\si{pb}]'
300+
xlog = False
302301
ylog = False
303-
description = r'LHCb differential W-boson production cross section at 7 TeV'
302+
title = r'LHCb differential W-boson production cross section at 7 TeV'
304303
305304
data_slices = data()
306305
@@ -310,10 +309,10 @@ def main():
310309
311310
figure, axes = plt.subplots(len(panels), 1, sharex=True, squeeze=False)
312311
313-
if len(kwargs['x']) != 2 and xunit != '':
312+
if len(kwargs['x']) > 2 and xlog:
314313
axes[0, 0].set_xscale('log')
315314
316-
axes[ 0, 0].set_title(description)
315+
axes[ 0, 0].set_title(title)
317316
axes[-1, 0].set_xlabel(xlabel)
318317
319318
for plot, axis in zip(panels, axes[:, 0]):

0 commit comments

Comments
 (0)