0
我想設置圖例中的繪圖數據。pylab繪圖圖例錯誤
但我的代碼似乎有錯誤。 我有以下的錯誤,在這裏我設置一個傳奇的情節線:
a.set_transform(self.get_transform())
AttributeError: 'NoneType' object has no attribute 'set_transform'
我的代碼如下:
import numpy as np;
from pylab import *;
newData = np.array([[1,2],[2,3],[3,4]])
Action = 'abc'
line1 = 'class 0-' + Action
line2 = 'class 1 -others'
plot(newData[:,0],newData[:,1],'-')
figlegend((line1, line2),('*', '-'),'upper right')
hold(True)
plot(newData[:,1],newData[:,0],'*')
grid(True)
show()