我很難理解圖例處理。從官方matplotlib legend guidematplotlib中的圖例句柄的基本示例中的typeerror
import matplotlib.pyplot as plt
line_up, = plt.plot([1,2,3], label='Line 2')
line_down, = plt.plot([3,2,1], label='Line 1')
plt.legend(handles=[line_up, line_down])
越多,基本的例子失敗,TypeError: __init__() got multiple values for keyword argument 'handles'
。
我在做什麼錯?有任何想法嗎?
我的matplotlib版本是1.3.1
。我在Ubuntu 14.04 ..
以下是完整的回溯(與在python腳本上面的線)
[email protected]:bauHS15_iomapsgenpod$ python testleg.py
Traceback (most recent call last):
File "testleg.py", line 4, in <module>
plt.legend(handles=[line_up, line_down])
File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 3381, in legend
ret = gca().legend(*args, **kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 4778, in legend
self.legend_ = mlegend.Legend(self, handles, labels, **kwargs)
TypeError: __init__() got multiple values for keyword argument 'handles'
也就是說奇...你能張貼_full_追溯? – tacaswell 2014-08-29 01:09:54
當然,我已經將它添加到問題主體。 – Jan 2014-08-29 09:32:40
我無法在1.4.0上重現這一點。這是一個已經修復的錯誤,或者是你的安裝有趣的事情。 – tacaswell 2014-08-29 12:37:57