Skip to content

Commit 5e46eaa

Browse files
committed
MAINT: update plot script to save to png.
1 parent 23622b6 commit 5e46eaa

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

scripts/plot-stress-test.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# AI note: this script is entirely generated using AI (claude code)
2+
import argparse
23
import sys
34
from pathlib import Path
45

@@ -8,11 +9,12 @@
89

910
sns.set_theme(style="darkgrid", palette="tab10")
1011

11-
if len(sys.argv) != 2:
12-
print(f"Usage: {sys.argv[0]} <csv_file>")
13-
sys.exit(1)
12+
parser = argparse.ArgumentParser()
13+
parser.add_argument("csv_file")
14+
parser.add_argument("-s", action="store_true", help="save plot to PNG instead of displaying")
15+
args = parser.parse_args()
1416

15-
csv_path = Path(sys.argv[1])
17+
csv_path = Path(args.csv_file)
1618
matrix_name = csv_path.stem
1719

1820
df = pd.read_csv(csv_path)
@@ -62,4 +64,9 @@
6264
axes[0, 0].legend()
6365
fig.suptitle(matrix_name)
6466
fig.tight_layout()
65-
plt.show()
67+
if args.s:
68+
png_path = csv_path.with_suffix(".png")
69+
fig.savefig(png_path)
70+
print(f"Saved to {png_path}")
71+
else:
72+
plt.show()

0 commit comments

Comments
 (0)