Skip to content
Snippets Groups Projects
Commit b539c508 authored by Johannes Mey's avatar Johannes Mey
Browse files

plot axes now exchangeable [WIP]

parent 19d365bf
No related branches found
No related tags found
No related merge requests found
...@@ -62,14 +62,17 @@ def plot_range(names, labels, ax): ...@@ -62,14 +62,17 @@ def plot_range(names, labels, ax):
means = data.total means = data.total
rect = ax.bar((ind + i * (N + 0.5)) * width, means, width=width, color=colors) rect = ax.bar((ind + i * (N + 0.5)) * width, means, width=width, color=colors)
for r, isValid, color in zip(rect, data.Valid, 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()), ax.text(r.get_x() + r.get_width() / 2,
patterns[isValid], r.get_height() * 1.4,
patterns[isValid], # the text
fontname='symbola', fontsize=16, ha='center', va='bottom', color='black') 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()), '%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): ...@@ -80,25 +83,50 @@ def plot_range(names, labels, ax):
def create_grid(): def create_grid():
variants = (2, 4) variants = [2, 4]
requests = (1, 2, 3) requests = [1, 2, 3]
depth = (1, 2, 3) depth = [1, 2, 3]
resources = [15, 30] resources = [15, 30]
y_dimension = (requests, "Requests")
fig, axs = plt.subplots(len(variants), len(requests), figsize=(12, 12), subplot_kw=dict(yscale="log")) x_dimension = (variants, "Implementation\nVariants")
inner_dimension = (depth, "Depth")
for v, i in zip(variants, range(len(variants))): fixed_dimension = (resources, "Resources")
for q, j in zip(requests, range(len(requests))): fixed_dimension_fix = 0
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]) pos_map = {
"Implementation\nVariants": 0,
for i in range(len(variants)): "Requests": 1,
axs[i][-1].set_ylabel('Implementation\nVariants = ' + str(variants[i]), rotation=0) "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) axs[i][-1].yaxis.set_label_coords(1.2, 0.5)
for i in range(len(requests)): for i in range(len(x_dimension[0])):
axs[0][i].set_xlabel('Requests = ' + str(requests[i]), rotation=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) axs[0][i].xaxis.set_label_coords(0.5, 1.05)
fig.patch.set_facecolor('w') fig.patch.set_facecolor('w')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment