aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-04-03 10:11:46 -0400
committerDavid Robillard <d@drobilla.net>2023-04-06 07:19:10 -0400
commit0065bfadaa18c53b077ded4fbca09da65ed84017 (patch)
treeefab86e14aaf36c689c5f51ab90a624f2f4d6389
parent00e44bec1c3c9150b21713442141a8adeae76365 (diff)
downloadserd-0065bfadaa18c53b077ded4fbca09da65ed84017.tar.gz
serd-0065bfadaa18c53b077ded4fbca09da65ed84017.tar.bz2
serd-0065bfadaa18c53b077ded4fbca09da65ed84017.zip
Fix benchmark plot axis range
-rwxr-xr-xscripts/serd_bench.py11
1 files 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()