jor*_*rto 1 python matplotlib legend
我想在python中的matplotib图中为一个图例添加一些文本.我在考虑创造一个空手柄,有什么办法吗?已经尝试过使用类似于:
ax.legend([handle1,handle2,None],[label1,label2,labelEmpty])
Run Code Online (Sandbox Code Playgroud)
但是图例不接受None关键字.(我收到错误$ Legend不支持None,请改用代理艺术家.$)
如果这是不可能的任何其他想法?
我正在考虑这样的事情:
___________________________
| handle1 - label1 |
| handle2 - label2 |
| labelEmpty |
!___________________________!
Run Code Online (Sandbox Code Playgroud)
谢谢!
空条目和标题:
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()
Run Code Online (Sandbox Code Playgroud)

| 归档时间: |
|
| 查看次数: |
4317 次 |
| 最近记录: |