【发布时间】:2020-01-23 09:14:03
【问题描述】:
我想更改matplotlib 中我的图例标题的字体大小。这是我的第一个猜测
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()
产生错误
File "test.py", line 6, in <module>
lg.set_title(fontsize='large')
TypeError: set_title() got an unexpected keyword argument 'fontsize'
我也试过了
lg = ax.legend(['test entry'],title='test',title_fontsize='large')
产生
self.legend_ = mlegend.Legend(self, handles, labels, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'title_fontsize'
【问题讨论】:
标签: python matplotlib legend