我想在python的matplotib图中向图例添加一些文本。我当时正在考虑创建一个空的句柄,有什么办法吗?已经通过使用类似于以下内容的东西尝试过:
ax.legend([handle1,handle2,None],[label1,label2,labelEmpty])
但图例不接受None关键字。 (我收到错误$ Legend不支持None,请改用代理艺术家。$)
如果这不可能,没有其他想法吗?
我正在考虑使用类似的东西:
___________________________
| handle1 - label1 |
| handle2 - label2 |
| labelEmpty |
!___________________________!
谢谢!
空条目和标题:
ax = gca()
h1, h2 = ax.plot(range(5), range(5), range(5), arange(5)**2)
r = matplotlib.patches.Rectangle((0,0), 1, 1, fill=False, edgecolor='none',
visible=False)
ax.legend([h1, h2, r], ['a', 'b', 'c'], loc=0, title='test')
plt.draw()
“ >>