在以下代码中,我是否错误地使用了fontsize参数?
根据文档,这应该是一个有效的关键字参数。
import pylab
pylab.plot(range(5), label='test')
pylab.legend(fontsize='small')
pylab.show()
追踪:
Traceback (most recent call last):
File "test_label.py", line 6, in <module>
pylab.legend(fontsize='small')
File "C:\swframe\python-V01-01\lib\site-packages\matplotlib\pyplot.py", line 2
791, in legend
ret = gca().legend(*args, **kwargs)
File "C:\swframe\python-V01-01\lib\site-packages\matplotlib\axes.py", line 447
5, in legend
self.legend_ = mlegend.Legend(self, handles, labels, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'fontsize'
Python: 2.7, Matplotlib: 1.1.0
编辑:注意,我不是在寻找设置字体大小的替代方法。我想知道为什么会出现问题。