For a change point detection task, I am testing my own algorithm against a baseline, and I would like to plot the results from the two algorithms on the same boxplot.
My results (F Score values) are stored in a dictionary where the keys are two parameters a and b (both with 4 distinct values):
resultsOwnAlgorithm = {'a1, b1': [0.8, 0.7, 0.6, ...], 'a1, b2': [...], ..., 'a2, b1': [...], ...}
resultsBaseline = {'a1, b1': [0.7, 0.6, ...], 'a1, b2': [...], ..., 'a2, b1': [...], ...}
For now, I have a function to plot them individually. I create 4 subplots where a is set and b is changing, see image (values are random, just to create an example image). The function looks like this:
def plotResults(results, keys, test):
fig, axs = plt.subplots(2,2,figsize=(10,10))
for ax in axs.flat:
ax.set_ylim(0,1)
ax.set_xticks(range(len(abrs)))
ax.set_xticklabels(abrs)
count = 0
for i in (0,1):
for j in (0,1):
axs[i,j].set_title(str(test) + ', mean shift: ' + str(keys[count][0][0:2]).strip('x,') + ', iters=' + str(iterations), fontweight ="bold")
l = keys[count]
k = {k:results[k] for k in l if k in results}
label, data = k.keys(), k.values()
axs[i,j].boxplot(data,showfliers=False,patch_artist=True)
axs[i,j].set_xticks(range(1, len(label) + 1))
axs[i,j].set_xticklabels(label)
count+=1
where results is either resultsOwnAlgorithm or resultsBaseline, keys is the dicitonary keys, so the different combinations of a and b, and test is just used to put which algorithm is being plotted in the title.
My question is: how do I plot them side by side on the same plot?


