diff --git a/jastadd-mquat-benchmark/results/plot.py b/jastadd-mquat-benchmark/results/plot.py index 949c39afafaab3e576bb7112525b6dd365c361a6..d80f654c11a5fd378dd1cca045b3ce71acb00feb 100644 --- a/jastadd-mquat-benchmark/results/plot.py +++ b/jastadd-mquat-benchmark/results/plot.py @@ -62,14 +62,17 @@ def plot_range(names, labels, ax): means = data.total rect = ax.bar((ind + i * (N + 0.5)) * width, means, width=width, color=colors) - for r, isValid, color in zip(rect, data.Valid, colors): - ax.text(r.get_x() + r.get_width() / 2, max(5, r.get_y() + r.get_height()), - patterns[isValid], + ax.text(r.get_x() + r.get_width() / 2, + r.get_height() * 1.4, + patterns[isValid], # the text fontname='symbola', fontsize=16, ha='center', va='bottom', color='black') - ax.text(r.get_x() + r.get_width() / 2, max(5, r.get_y() + r.get_height()), + + for r, isValid, color in zip(rect, data.Valid, colors): + ax.text(r.get_x() + r.get_width() / 2, + r.get_height(), '%d' % int(r.get_height()), - fontsize=10, ha='center', va='bottom', color='black') + fontsize=8, ha='center', va='bottom', color='black') @@ -80,25 +83,50 @@ def plot_range(names, labels, ax): def create_grid(): - variants = (2, 4) - requests = (1, 2, 3) - depth = (1, 2, 3) + variants = [2, 4] + requests = [1, 2, 3] + depth = [1, 2, 3] resources = [15, 30] - - fig, axs = plt.subplots(len(variants), len(requests), figsize=(12, 12), subplot_kw=dict(yscale="log")) - - for v, i in zip(variants, range(len(variants))): - for q, j in zip(requests, range(len(requests))): - plot_range(['size_v%d_q%d_d%d_r15.csv' % (v, q, d) for d in depth], ['depth = %d' % d for d in depth], - axs[i, j]) - - for i in range(len(variants)): - axs[i][-1].set_ylabel('Implementation\nVariants = ' + str(variants[i]), rotation=0) + y_dimension = (requests, "Requests") + x_dimension = (variants, "Implementation\nVariants") + inner_dimension = (depth, "Depth") + fixed_dimension = (resources, "Resources") + fixed_dimension_fix = 0 + + pos_map = { + "Implementation\nVariants": 0, + "Requests": 1, + "Depth": 2, + "Resources": 3 + } + + + + fig, axs = plt.subplots(len(y_dimension[0]), len(x_dimension[0]), figsize=(12, 12), subplot_kw=dict(yscale="log")) + + for y, y_pos in zip(y_dimension[0], range(len(y_dimension[0]))): + for x, x_pos in zip(x_dimension[0], range(len(x_dimension[0]))): + parameters = [] + labels = [] + for inner in inner_dimension[0]: + new_parameters = [0,0,0,0] + new_parameters[pos_map[x_dimension[1]]] = x + new_parameters[pos_map[y_dimension[1]]] = y + new_parameters[pos_map[inner_dimension[1]]] = inner + new_parameters[pos_map[fixed_dimension[1]]] = fixed_dimension[0][fixed_dimension_fix] + parameters += [new_parameters] + labels += [inner_dimension[1] + ' = %d' % inner] + print(parameters) + plot_range(['size_v%d_q%d_d%d_r%d.csv' % (p[0], p[1], p[2], p[3]) for p in parameters], [label for label in labels], + axs[y_pos, x_pos]) + + for i in range(len(y_dimension[0])): + axs[i][-1].set_ylabel(y_dimension[1] + ' = ' + str(y_dimension[0][i]), rotation=0) axs[i][-1].yaxis.set_label_coords(1.2, 0.5) - for i in range(len(requests)): - axs[0][i].set_xlabel('Requests = ' + str(requests[i]), rotation=0) + for i in range(len(x_dimension[0])): + axs[0][i].set_xlabel(x_dimension[1] + ' = ' + str(x_dimension[0][i]), rotation=0) axs[0][i].xaxis.set_label_coords(0.5, 1.05) fig.patch.set_facecolor('w')