Skip to content

Commit a16ccdc

Browse files
author
Ruslan Shaiakhmetov
committed
fix: internal label
1 parent d029605 commit a16ccdc

1 file changed

Lines changed: 45 additions & 6 deletions

File tree

benchmark_smart_plot.py

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,31 @@ 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="AUC, b=1")
305+
plot_horizontal_bar_chart(plot_data, ax[n_plot], xlabel="Area under the curve")
306+
text = ax[n_plot].text(
307+
0.95, 0.98, # Position (x, y) in axes coordinates
308+
f'b={b[:-2]}', # The text content
309+
fontsize=14, # Font size
310+
ha='right', va='top', # Align the text
311+
transform=ax[n_plot].transAxes, # Use the current axes' coordinate system
312+
color='black',
313+
alpha=1,
314+
)
315+
text.set_bbox(dict(facecolor='white', alpha=0.6, edgecolor='gray', boxstyle='round'))
306316
data_compare_with = plot_data.copy()
307317
else:
308318

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]}')
319+
plot_horizontal_bar_chart(plot_data, ax[n_plot], compare_data=data_compare_with, xlabel=f'Area under the curve')
320+
text = ax[n_plot].text(
321+
0.95, 0.98, # Position (x, y) in axes coordinates
322+
f'b={b[:-2]}', # The text content
323+
fontsize=14, # Font size
324+
ha='right', va='top', # Align the text
325+
transform=ax[n_plot].transAxes, # Use the current axes' coordinate system
326+
color='black',
327+
alpha=1,
328+
)
329+
text.set_bbox(dict(facecolor='white', alpha=0.6, edgecolor='gray', boxstyle='round'))
310330
data_compare_with = plot_data.copy()
311331

312332
# Axis failed in ax[0]
@@ -320,7 +340,7 @@ def parallel_acc(file_name):
320340
plt.savefig("img/Smart_plot_1.pdf", format="pdf", dpi=300)
321341
plt.close()
322342

323-
if False:
343+
if True:
324344

325345
fig, ax = plt.subplots(1, 4, figsize=(12, 6))
326346

@@ -361,7 +381,17 @@ def parallel_acc(file_name):
361381
###############################
362382
# Plot the chart
363383
if n_plot == 3:
364-
plot_horizontal_bar_chart(plot_data_without, ax[n_plot], xlabel="AUC, b=1000", red=False)
384+
plot_horizontal_bar_chart(plot_data, ax[n_plot], xlabel="Area under the curve", red=False)
385+
text = ax[n_plot].text(
386+
0.95, 0.98, # Position (x, y) in axes coordinates
387+
f'b={b[:-2]}', # The text content
388+
fontsize=14, # Font size
389+
ha='right', va='top', # Align the text
390+
transform=ax[n_plot].transAxes, # Use the current axes' coordinate system
391+
color='black',
392+
alpha=1,
393+
)
394+
text.set_bbox(dict(facecolor='white', alpha=0.6, edgecolor='gray', boxstyle='round'))
365395
continue
366396
parallel_task = []
367397
for each in algorithm_list:
@@ -389,8 +419,17 @@ def parallel_acc(file_name):
389419
nice_label = each.replace("optim.", "").replace("torch.", "")
390420
plot_data_without[nice_label] = results[i]
391421

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-
422+
plot_horizontal_bar_chart(plot_data_without, ax[n_plot], compare_data=plot_data, xlabel=f'Area under the curve', low_labels = True)
423+
text = ax[n_plot].text(
424+
0.95, 0.98, # Position (x, y) in axes coordinates
425+
f'b={b[:-2]}', # The text content
426+
fontsize=14, # Font size
427+
ha='right', va='top', # Align the text
428+
transform=ax[n_plot].transAxes, # Use the current axes' coordinate system
429+
color='black',
430+
alpha=1,
431+
)
432+
text.set_bbox(dict(facecolor='white', alpha=0.6, edgecolor='gray', boxstyle='round'))
394433

395434
# Adjust layout and show
396435
plt.tight_layout()

0 commit comments

Comments
 (0)