I'm having some trouble trying to set the color of legend entries. I want to select the same color as the line they are referring to. Here i post a runable script
import matplotlib.pyplot as plt
x, y = [1,2],[1,2]
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x,y,label='test',color='r')
ax.legend(labelcolor='r')
plt.show()
And that's the error I'm getting
Traceback (most recent call last):
File "test.py", line 11, in <module>
ax.legend(labelcolor='r')
File "/home/username/anaconda3/lib/python3.7/site-packages/matplotlib/axes/_axes.py", line 406, in legend
self.legend_ = mlegend.Legend(self, handles, labels, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'labelcolor'
However I saw in the legend documentation that labelcolor should work as argument. Do you have any suggestions?
Thank you in advance