Select Git revision
result_plot.py

Jammer, Tim authored
result_plot.py 3.29 KiB
# script to generate the evaluation results plot shown in the paper
import pandas as pd
import os
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_theme()
sns.set_style("whitegrid")
# input path
input_path = "/home/tim/mpi-bugbench/logs/mpi-bugbench-results/logs-20240723-151721/csv"
# output path
plot_path = "/home/tim/paper/2024_eurompi_mpi-bugbench-paper/media"
df_itac = pd.read_csv(os.path.join(input_path, "itac_base.csv"), index_col=0)
df_parcoach = pd.read_csv(os.path.join(input_path, "parcoach_base.csv"), index_col=0)
df_must = pd.read_csv(os.path.join(input_path, "must_base.csv"), index_col=0)
df_coll = pd.DataFrame(columns=df_itac.columns)
df_coll.loc["MUST"] = df_must.loc["COLL"]
df_coll.loc["ITAC"] = df_itac.loc["COLL"]
df_coll.loc["PARCOACH"] = df_parcoach.loc["COLL"]
df_p2p = pd.DataFrame(columns=df_itac.columns)
df_p2p.loc["MUST"] = df_must.loc["P2P"]
df_p2p.loc["ITAC"] = df_itac.loc["P2P"]
df_p2p.loc["PARCOACH"] = df_parcoach.loc["P2P"]
df_rma = pd.DataFrame(columns=df_itac.columns)
df_rma.loc["MUST"] = df_must.loc["RMA"]
df_rma.loc["ITAC"] = df_itac.loc["RMA"]
df_rma.loc["PARCOACH"] = df_parcoach.loc["RMA"]
df_total = pd.DataFrame(columns=df_itac.columns)
df_total.loc["MUST"] = df_must.loc["ALL"]
df_total.loc["ITAC"] = df_itac.loc["ALL"]
df_total.loc["PARCOACH"] = df_parcoach.loc["ALL"]
SMALL_SIZE = 20
MEDIUM_SIZE = 22
BIGGER_SIZE = 24
plt.rc('font', size=SMALL_SIZE) # controls default text sizes
plt.rc('axes', titlesize=SMALL_SIZE) # fontsize of the axes title
plt.rc('axes', labelsize=SMALL_SIZE) # fontsize of the x and y labels
plt.rc('xtick', labelsize=SMALL_SIZE) # fontsize of the tick labels
plt.rc('ytick', labelsize=SMALL_SIZE) # fontsize of the tick labels
plt.rc('legend', fontsize=SMALL_SIZE) # legend fontsize
plt.rc('figure', titlesize=BIGGER_SIZE) # fontsize of the figure title
fig, axs = plt.subplots(nrows=2, ncols=2, figsize=(16, 9)) #
#colors = ['#228833', '#66ccee', '#ee6677', '#aa3377', '#ccbb44', '#bbbbbb']
colors = ['#6699CC', '#EECC66', '#004488', '#997700', '#BBBBBB', '#000000']
colors_2 = {'TP': '#117733', 'TN': '#88CCEE', 'FP': '#CC6677', 'FN': '#AA4499', 'RE': '#DDCC77', 'CE': '#DDDDDD'}
hatches= ["","",".",".","",""]
((ax1, ax2), (ax3, ax4)) = axs
df_p2p[["TP", "TN", "FP", "FN", "RE", "CE"]].plot.barh(stacked=True, ax=ax1, legend=False,color=colors)
ax1.set_title('P2P')
handles, labels = ax1.get_legend_handles_labels()
df_coll[["TP", "TN", "FP", "FN", "RE", "CE"]].plot.barh(stacked=True, ax=ax2, legend=False, color=colors)
ax2.set_title('Collective')
ax2.yaxis.tick_right()
# Set the y-axis labels to uppercase
ax2.set_yticklabels([label.get_text().upper() for label in ax2.get_yticklabels()])
df_rma[["TP", "TN", "FP", "FN", "RE", "CE"]].plot.barh(stacked=True, ax=ax3, legend=False, color=colors)
ax3.set_title('RMA')
df_total[["TP", "TN", "FP", "FN", "RE", "CE"]].plot.barh(stacked=True, ax=ax4, legend=False, color=colors)
ax4.set_title('Total')
ax4.yaxis.tick_right()
for ax in [ax1, ax2, ax3, ax4]:
ax.set_ylabel('')
# Set the y-axis labels to uppercase
ax.set_yticklabels([label.get_text().upper() for label in ax.get_yticklabels()])
fig.legend(handles, labels, loc='upper center', ncols=6, bbox_to_anchor=(0.5, 1.05), )
plt.tight_layout()
plt.savefig(os.path.join(plot_path, "results_per_cat.pdf"), bbox_inches="tight")