Skip to content

Commit d029605

Browse files
author
Ruslan Shaiakhmetov
committed
fix: labels for Smart chart 1 and 11
1 parent 09ce734 commit d029605

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

benchmark_smart_plot.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
viridis = plt.get_cmap()
1414

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):
1616
"""
1717
Plots a horizontal bar chart on the provided AxesSubplot (ax) with a log-scaled x-axis.
1818
@@ -56,7 +56,7 @@ def plot_horizontal_bar_chart(data, ax, compare_data = None, xlabel='X label', s
5656

5757
ax.barh(categories, error_values, color=color_smart, height=1.0)
5858
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)
6060

6161

6262
# Set log scale for the x-axis
@@ -266,7 +266,7 @@ def rosenbrock(x, y, b=100):
266266
"optim.QHAdam",
267267
]
268268

269-
if False:
269+
if True:
270270

271271
fig, ax = plt.subplots(1, 4, figsize=(12, 6))
272272

@@ -302,11 +302,11 @@ def parallel_acc(file_name):
302302

303303
# Plot the chart
304304
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")
306306
data_compare_with = plot_data.copy()
307307
else:
308308

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]}')
310310
data_compare_with = plot_data.copy()
311311

312312
# Axis failed in ax[0]
@@ -361,7 +361,7 @@ def parallel_acc(file_name):
361361
###############################
362362
# Plot the chart
363363
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)
365365
continue
366366
parallel_task = []
367367
for each in algorithm_list:
@@ -389,7 +389,7 @@ def parallel_acc(file_name):
389389
nice_label = each.replace("optim.", "").replace("torch.", "")
390390
plot_data_without[nice_label] = results[i]
391391

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)
393393

394394

395395
# Adjust layout and show

0 commit comments

Comments
 (0)