@@ -121,19 +121,26 @@ def plot_results_against_bandlimit(
121121 measurements : tuple [str ] = ("times" , "flops" , "memory" , "error" ),
122122 axis_size : float = 3.0 ,
123123 fig_dpi : int = 100 ,
124+ functions_along_columns : bool = False ,
124125) -> tuple [plt .Figure , plt .Axes ]:
125126 benchmark_results_path = Path (benchmark_results_path )
126127 with benchmark_results_path .open ("r" ) as f :
127128 benchmark_results = json .load (f )
128129 n_functions = len (functions )
129130 n_measurements = len (measurements )
131+ n_rows , n_cols = (
132+ (n_measurements , n_functions )
133+ if functions_along_columns
134+ else (n_functions , n_measurements )
135+ )
130136 fig , axes = plt .subplots (
131- n_functions ,
132- n_measurements ,
133- figsize = (axis_size * n_measurements , axis_size * n_functions ),
137+ n_rows ,
138+ n_cols ,
139+ figsize = (axis_size * n_cols , axis_size * n_rows ),
134140 dpi = fig_dpi ,
135141 squeeze = False ,
136142 )
143+ axes = axes .T if functions_along_columns else axes
137144 for axes_row , function in zip (axes , functions ):
138145 results = benchmark_results ["results" ][function ]
139146 l_values = np .array ([r ["parameters" ]["L" ] for r in results ])
@@ -183,6 +190,11 @@ def _parse_cli_arguments() -> argparse.Namespace:
183190 parser .add_argument (
184191 "-title" , type = str , help = "Title for figure. No title added if omitted."
185192 )
193+ parser .add_argument (
194+ "--functions-along-columns" ,
195+ action = "store_true" ,
196+ help = "Whether to orient axes with functions along columns instead of rows." ,
197+ )
186198 return parser .parse_args ()
187199
188200
@@ -202,6 +214,7 @@ def _parse_cli_arguments() -> argparse.Namespace:
202214 measurements = measurements ,
203215 axis_size = args .axis_size ,
204216 fig_dpi = args .dpi ,
217+ functions_along_columns = args .functions_along_columns ,
205218 )
206219 if args .title is not None :
207220 fig .suptitle (args .title )
0 commit comments