From c43f7d9dd6373eb364f914c48953173c83d56b5a Mon Sep 17 00:00:00 2001 From: Frey Alfredsson Date: Tue, 4 Jul 2023 15:19:16 +0200 Subject: [PATCH] Fixed log-scale matplotlib compatibility for v3.3 The matplotlib package removed all axis directions from the base parameters for logarithmic scaling functions in v3.3.0 and up. This commit supports both the original "basex" and "basey" parameters for older versions of matplotlib and the new "base" parameter for more recent versions of matplotlib. Signed-off-by: Frey Alfredsson --- flent/plotters.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/flent/plotters.py b/flent/plotters.py index c0c36218..37e837fd 100644 --- a/flent/plotters.py +++ b/flent/plotters.py @@ -1238,7 +1238,10 @@ def _do_scaling(self, axis, data, btm, top, unit=None, allow_log=True): axis.set_ylim(0, top_scale) else: if self.log_base: - axis.set_yscale('log', basey=self.log_base) + try: + axis.set_yscale('log', base=self.log_base) + except TypeError: + axis.set_yscale('log', basey=self.log_base) axis.set_ylim(max(0, btm_scale), top_scale) else: axis.set_ylim(btm_scale, top_scale) @@ -1884,7 +1887,10 @@ def _plot(self, results, config=None, axis=None, postfix="", axis.set_xlim(left=min(min_value, axis.get_xlim()[0])) if self.log_base: - axis.set_xscale('log', basex=self.log_base) + try: + axis.set_xscale('log', base=self.log_base) + except TypeError: + axis.set_xscale('log', basex=self.log_base) for a, b in zip(config['axes'], self.bounds_x): a.set_xbound(b)