How can make three legends and colors of the legends same as the bars colors in matplotlib,. following is my code : 'import numpy as np

import matplotlib.pyplot as plt

x=[1,2,3]

y=[399,499,100]

LABELS = ["node0", "node1", "failed"]

cr = ['g','r','b']

fig,ax = plt.subplots()

ax.bar(x,y,align='center',color=cr, Label='txed, rxed, failed')

plt.xticks(x, LABELS)

plt.legend()

plt.show()

