2009-10-28 5 views
12

私はmatplotlib 0.99を使用します。matplotlib border width

私はそれを行うことができますどのように、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) 

最後の2行は動作しませんが、以下が正常に動作します:

legend.get_frame().set_ linewidth(0.1) 

答えて

21

あなたは境界線のサイズを調整したいですか? ax.spines [side] .set_linewidth(size)を使う必要があります。

だから、のようなもの:

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

感謝!これは役に立ちます。 –

+0

これは古い質問ですが、Python 3ではまだ.iterue()の代わりに.values()を使用しています! –

+0

@CharlesParr、私は年をとらないでください! – Mark

7

は、たぶん、これはあなたが探しているものでしょうか?

import matplotlib as mpl

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