import numpy as np
import matplotlib.pyplot as plt

best = np.loadtxt("tmp/best.txt", dtype=str)
metody = np.core.defchararray.add(np.core.defchararray.add(best[:,1], " "), best[:,3])

data = None

labels = ['Trén.', 'Test 1', 'Test 2', 'Test 3', 'Test 4', 'Test 5', 'Test 6', 'Test 7', 'Test 8', 'Test 9']
x = np.arange(len(labels))  # the label locations
width = 0.9  # the width of the bars
fig, ax = plt.subplots()
ax.grid(axis="y")

for i in range(metody.shape[0]):
	err = np.loadtxt("../results/greg_door_2016_min/"+str(best[i,1])+"_"+str(best[i,3])+".txt")
	rects = ax.bar(x + (width/metody.shape[0]*i) - width/2, err[:,0], width/metody.shape[0], label=metody[i])
	#autolabel(rects)

# Add some text for labels, title and custom x-axis tick labels, etc.
ax.set_ylabel('Střední kvadratická chyba')
ax.set_title('Úloha s dveřmi')
ax.set_xticks(x)
ax.set_xticklabels(labels)
ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))

fig.tight_layout()

plt.show()

