From 348dbe9ed37b0840e2098382c25b5e8d537bb3aa Mon Sep 17 00:00:00 2001 From: acrovato <a.crovato@uliege.be> Date: Wed, 26 Jul 2023 16:04:38 +0200 Subject: [PATCH] Remove custom parser from utils --- tbox/utils.py | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/tbox/utils.py b/tbox/utils.py index 73ec554..01ba3c9 100644 --- a/tbox/utils.py +++ b/tbox/utils.py @@ -34,28 +34,25 @@ def myrange(start, stop, step): def plot(x, y, cfg): """Plot using matplotlib """ - from fwk.wutils import parseargs - args = parseargs() - if not args.nogui: - import matplotlib.pyplot as plt - # define font - font = {'family': 'serif', 'color': 'darkred', 'weight': 'normal', 'size': 16} - # plot results - plt.plot(x, y, 'b-', lw=2) - if 'xlabel' in cfg: - plt.xlabel(cfg['xlabel'], fontdict=font) - if 'ylabel' in cfg: - plt.ylabel(cfg['ylabel'], fontdict=font) - if 'title' in cfg: - plt.title(cfg['title'], fontdict=font) - if 'xlim' in cfg: - plt.xlim(cfg['xlim']) - if 'ylim' in cfg: - plt.ylim(cfg['ylim']) - if 'invert' in cfg and cfg['invert']: - plt.gca().invert_yaxis() - # display - plt.show() + import matplotlib.pyplot as plt + # define font + font = {'family': 'serif', 'color': 'darkred', 'weight': 'normal', 'size': 16} + # plot results + plt.plot(x, y, 'b-', lw=2) + if 'xlabel' in cfg: + plt.xlabel(cfg['xlabel'], fontdict=font) + if 'ylabel' in cfg: + plt.ylabel(cfg['ylabel'], fontdict=font) + if 'title' in cfg: + plt.title(cfg['title'], fontdict=font) + if 'xlim' in cfg: + plt.xlim(cfg['xlim']) + if 'ylim' in cfg: + plt.ylim(cfg['ylim']) + if 'invert' in cfg and cfg['invert']: + plt.gca().invert_yaxis() + # display + plt.show() def sort(id, data): """Sort data array against id (line connectivity list) -- GitLab