matplotlib边框宽度 [英] matplotlib border width

查看:197
本文介绍了matplotlib边框宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用matplotlib 0.99.

I use matplotlib 0.99.

我不能更改 subplot 的边框宽度,该怎么办?

I am not able to change width of border of subplot, how can I do it?

代码如下:

fig = plt.figure(figsize = (4.1, 2.2))
ax = fig.add_subplot(111)

ax.patch.set_ linewidth(0.1) 
ax.get_frame().set_linewidth(0.1) 

最后两行不起作用,但以下命令可以正常工作:

The last two lines do not work, but the following works fine:

legend.get_frame().set_ linewidth(0.1)

推荐答案

您要调整边框线的大小吗?您需要使用ax.spines [side] .set_linewidth(size).

You want to adjust the border line size? You need to use ax.spines[side].set_linewidth(size).

所以像这样:

[i.set_linewidth(0.1) for i in ax.spines.itervalues()]

这篇关于matplotlib边框宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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