Matplotlib:图例中的水平线长 [英] Matplotlib: Horizontal Linelength in Legend

查看:59
本文介绍了Matplotlib:图例中的水平线长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我正在用 matplotlib 绘制一条线并添加一个图例.在图例中,它说 ------ Label.在绘制用于打印的小图形尺寸时,我发现这条线的默认水平长度有点太长了.

Lets say i'm plotting a line with matplotlib and add a legend. Within the legend it says ------ Label. I find the default horizontal length of this line a bit too long when plotting small figure sizes for print.

是否存在将 -------- Label 设置为 --- Label 的属性?

Is there a property to set ------ Label to --- Label?

推荐答案

创建图例时,添加 handlelength 关键字

When you create your legend add the handlelength keyword (doc) which sets the length of the '---' (which is called the handle).

这篇关于Matplotlib:图例中的水平线长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆