|
12 | 12 |
|
13 | 13 | viridis = plt.get_cmap() |
14 | 14 |
|
15 | | -def plot_horizontal_bar_chart(data, ax, compare_data = None, xlabel='X label', show_increase=True, low_labels = False, reverse=True): |
| 15 | +def plot_horizontal_bar_chart(data, ax, compare_data = None, xlabel='X label', show_increase=True, low_labels = False, reverse=True, red=True): |
16 | 16 | """ |
17 | 17 | Plots a horizontal bar chart on the provided AxesSubplot (ax) with a log-scaled x-axis. |
18 | 18 | |
@@ -56,7 +56,7 @@ def plot_horizontal_bar_chart(data, ax, compare_data = None, xlabel='X label', s |
56 | 56 |
|
57 | 57 | ax.barh(categories, error_values, color=color_smart, height=1.0) |
58 | 58 | else: |
59 | | - ax.barh(categories, values, color=color_smart, height=1.0) |
| 59 | + ax.barh(categories, values, color=error_color_smart if red else color_smart, height=1.0) |
60 | 60 |
|
61 | 61 |
|
62 | 62 | # Set log scale for the x-axis |
@@ -266,7 +266,7 @@ def rosenbrock(x, y, b=100): |
266 | 266 | "optim.QHAdam", |
267 | 267 | ] |
268 | 268 |
|
269 | | - if False: |
| 269 | + if True: |
270 | 270 |
|
271 | 271 | fig, ax = plt.subplots(1, 4, figsize=(12, 6)) |
272 | 272 |
|
@@ -302,11 +302,11 @@ def parallel_acc(file_name): |
302 | 302 |
|
303 | 303 | # Plot the chart |
304 | 304 | if n_plot == 0: |
305 | | - plot_horizontal_bar_chart(plot_data, ax[n_plot], xlabel="Averaged integral metric of\n Rosenbrock parameter 1.0") |
| 305 | + plot_horizontal_bar_chart(plot_data, ax[n_plot], xlabel="AUC, b=1") |
306 | 306 | data_compare_with = plot_data.copy() |
307 | 307 | else: |
308 | 308 |
|
309 | | - plot_horizontal_bar_chart(plot_data, ax[n_plot], compare_data=data_compare_with, xlabel=f'Averaged integral metric of\n Rosenbrock parameter {rosen_list[n_plot]}\n with respect to {rosen_list[n_plot-1]}') |
| 309 | + plot_horizontal_bar_chart(plot_data, ax[n_plot], compare_data=data_compare_with, xlabel=f'AUC, b={rosen_list[n_plot][:-2]}\n with respect to b={rosen_list[n_plot-1][:-2]}') |
310 | 310 | data_compare_with = plot_data.copy() |
311 | 311 |
|
312 | 312 | # Axis failed in ax[0] |
@@ -361,7 +361,7 @@ def parallel_acc(file_name): |
361 | 361 | ############################### |
362 | 362 | # Plot the chart |
363 | 363 | if n_plot == 3: |
364 | | - plot_horizontal_bar_chart(plot_data_without, ax[n_plot], xlabel="Averaged integral metric of\n Rosenbrock parameter 1000.0") |
| 364 | + plot_horizontal_bar_chart(plot_data_without, ax[n_plot], xlabel="AUC, b=1000", red=False) |
365 | 365 | continue |
366 | 366 | parallel_task = [] |
367 | 367 | for each in algorithm_list: |
@@ -389,7 +389,7 @@ def parallel_acc(file_name): |
389 | 389 | nice_label = each.replace("optim.", "").replace("torch.", "") |
390 | 390 | plot_data_without[nice_label] = results[i] |
391 | 391 |
|
392 | | - plot_horizontal_bar_chart(plot_data_without, ax[n_plot], compare_data=plot_data, xlabel=f'Averaged integral metric of\n Rosenbrock parameter {rosen_list[n_plot]}', low_labels = True) |
| 392 | + plot_horizontal_bar_chart(plot_data_without, ax[n_plot], compare_data=plot_data, xlabel=f'AUC, b={rosen_list[n_plot][:-2]}', low_labels = True) |
393 | 393 |
|
394 | 394 |
|
395 | 395 | # Adjust layout and show |
|
0 commit comments