Skip to content

Commit

Permalink
Merge PR 287: Fixed log-scale matplotlib compatibility for v3.3
Browse files Browse the repository at this point in the history
Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
  • Loading branch information
tohojo committed Apr 10, 2024
2 parents 927f5b5 + c43f7d9 commit 6c8dce5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions flent/plotters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 6c8dce5

Please sign in to comment.