data = {'A1_mean': [0.457, 1], 'A2_median': [0.391, 1], 'A3_range': [0.645,
    1], 'A4_std': [0.111, 1], 'B1_mean': [0.132, 3], 'B2_median': [0.1, 3],
    'B3_range': [0.244, 3], 'B4_std': [0.297, 3], 'C1_mean': [0.286, 2],
    'C2_median': [0.231, 2], 'C3_range': [0.554, 2], 'C4_std': [0.147, 2]}
df = pd.DataFrame(data).T
color = {(1): 'red', (2): 'green', (3): 'blue'}
labels = ['A', 'C', 'B']
fig, ax = plt.subplots()
df[0].plot(ax=ax, kind='bar', color=df[1].map(color))
handles = []
for i, c in list(color.items()):
    handles.append(mpatches.Patch(color=c, label=labels[i - 1]))
plt.legend(handles=handles, loc='best')
fig.autofmt_xdate()
plt.show()
Построение легенды с правильными метками python