正如标题所示TypeError
,调用以下方法时我得到了:
plt.pie(ylist, labels=xlist, autopct='%1.1f%%', startangle=90, counterclock=False)
>>> TypeError: pie() got an unexpected keyword argument 'startangle'
当我离开了startangle
我得到TypeError
的counterclock
:
plt.pie(ylist, labels=xlist, autopct='%1.1f%%', counterclock=False)
>>> TypeError: pie() got an unexpected keyword argument 'counterclock'
当我也忽略了counterclock
它时,它可以正常工作,并且可以得到理想的绘图。
但是根据文档,这两个关键字实际上存在,并且我还检查了python-matplotlib库的版本是否为最新版本(模块matplotlib.pyplot可能已过时,而matplotlib仍为最新时,日期,是吗?)。顺便说一句,我正在使用Python 2.7.3。
有人可以解释这个错误吗?
实际上,matplotlib版本1.1.x没有:
def pie(x, explode=None, labels=None, colors=None, autopct=None,
pctdistance=0.6, shadow=False, labeldistance=1.1, hold=None):
1.4.0版可以:
def pie(x, explode=None, labels=None, colors=None, autopct=None,
pctdistance=0.6, shadow=False, labeldistance=1.1, startangle=None,
radius=None, counterclock=True, wedgeprops=None, textprops=None,
hold=None)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句