I would like to change the fontsize of the title of my legend in matplotlib
. Here's my first guess
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.gca()
ax.plot(range(10))
lg = ax.legend(['test entry'],title='test')
lg.set_title(fontsize='large')
plt.show()
which produces the error
File "test.py", line 6, in <module>
lg.set_title(fontsize='large')
TypeError: set_title() got an unexpected keyword argument 'fontsize'
I also tried
lg = ax.legend(['test entry'],title='test',title_fontsize='large')
which produces
self.legend_ = mlegend.Legend(self, handles, labels, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'title_fontsize'