gro*_*ver 5 python plot matplotlib legend rectangles
我遇到的问题是标记非常接近图例的边缘。我为空条目创建了一个矩形,并希望可以调整宽度,以便在左侧添加空间。
我试图仅在图例的左侧添加空间。使用 borderpad 会为图例的所有边添加空间,这不是我想要做的事情。
这里的一些图像提供了我试图解决的问题的一些很好的例子:http://matplotlib.org/1.3.1/examples/pylab_examples/filledmarker_demo.html
extra = Rectangle((0, 0), 1, 1, fc="w", fill=False, edgecolor='w', linewidth=0)
lns = (line1, line2, line3, extra)
labs = ["label1", "label2", "label3", "label4"]
legend = ax1.legend(lns, labs, loc=4, numpoints=1, handlelength=0, handletextpad=1, fontsize=16, shadow=True)
frame = legend.get_frame()
frame.set_facecolor('0.90')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1037 次 |
| 最近记录: |