我试着在一副图中放置一个传奇,但我做不到。下面是我要做的一个例子:
def test():
fig = plt.figure()
ax1 = fig.add_subplot(111)
V = 10
X = range (V)
char = 'a'
leg = []
legp = []
for i in range (0,5):
Y = np.random.randn(V)
ap = ax1.plot(X,Y)
legp.append(ap)
char = chr(ord(char)+1)
leg.append(char)
fig.legend(legp,leg)
fig.show()
这是一个空洞的传说。我也收到一堆警告信息:
warnings.warn("Legend does not support %s\nUse proxy artist instead.\n\nhttp://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist\n" % (str(orig_handle),)) /usr/lib/pymodules/python2.7/matplotlib/legend.py:610: UserWarning: Legend does not support [] Use proxy artist instead.
http://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist
warnings.warn("Legend does not support %s\nUse proxy artist instead.\n\nhttp://matplotlib.sourceforge.net/users/legend_guide.html#using-proxy-artist\n" % (str(orig_handle),))
我想这和这个“代理艺术家”有关,但它指出的链接是从哪里开始学的。在
对于那些想知道的人,我只想在传说中包括一部分绘制的情节。在
那我怎么才能做到呢?在
编辑 我在Ubuntu12.10和gnome上使用了Python2.7.3。在
奇怪。。。对我来说似乎很管用。在
编辑:问题来自解压plot return对象:
ap, = ax1.plot(X,Y)
有关逗号用法的详细信息:
编辑结束
参见:
结果是:
相关问题 更多 >
编程相关推荐