From 0065bfadaa18c53b077ded4fbca09da65ed84017 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 3 Apr 2023 10:11:46 -0400 Subject: Fix benchmark plot axis range --- scripts/serd_bench.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/serd_bench.py b/scripts/serd_bench.py index f3c3e148..54ec3f29 100755 --- a/scripts/serd_bench.py +++ b/scripts/serd_bench.py @@ -115,18 +115,18 @@ def plot(in_file, out_filename, x_label, y_label, y_max=None): ax.set_xlabel(x_label) ax.set_ylabel(y_label) - if y_max is not None: - ax.set_ylim([0.0, y_max]) - ax.grid(linewidth=0.25, linestyle=":", color="0", dashes=[0.2, 1.6]) ax.ticklabel_format(style="sci", scilimits=(4, 0), useMathText=True) ax.tick_params(axis="both", width=0.75) x = list(map(float, cols[0])) + actual_y_max = 0.0 for i, y in enumerate(cols[1::]): + y_floats = list(map(float, y)) + actual_y_max = max(actual_y_max, max(y_floats)) ax.plot( x, - list(map(float, y)), + y_floats, label=header[i + 1], marker=next(markers), dashes=next(dashes), @@ -134,6 +134,9 @@ def plot(in_file, out_filename, x_label, y_label, y_max=None): linewidth=1.0, ) + y_max = actual_y_max if y_max is None else y_max + ax.set_ylim([0.0, y_max]) + plt.legend(labelspacing=0.25) plt.savefig(out_filename, bbox_inches="tight", pad_inches=0.125) plt.close() -- cgit v1.2.1