File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change 11# AI note: this script is entirely generated using AI (claude code)
2+ import argparse
23import sys
34from pathlib import Path
45
89
910sns .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 )
1618matrix_name = csv_path .stem
1719
1820df = pd .read_csv (csv_path )
6264axes [0 , 0 ].legend ()
6365fig .suptitle (matrix_name )
6466fig .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 ()
You can’t perform that action at this time.
0 commit comments