matplotlib边框宽度

时间:2009-10-28 19:14:58

标签: python width matplotlib border

我使用matplotlib 0.99。

我无法更改subplot的边框宽度,我该怎么办?

代码如下:

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) 

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

legend.get_frame().set_ linewidth(0.1)

2 个答案:

答案 0 :(得分:29)

您想调整边框线尺寸吗?你需要使用ax.spines [side] .set_linewidth(size)。

类似于:

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

答案 1 :(得分:15)

也许这就是你要找的东西?

import matplotlib as mpl

mpl.rcParams['axes.linewidth'] = 0.1 #set the value globally

相关问题