开发者

matplotlib border width

开发者 https://www.devze.com 2022-12-09 13:19 出处:网络
I use matplotlib 0.99. I am not able to change width of border of subplot, how can I do it? Code is as follows:

I use matplotlib 0.99.

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

Code is as follows:

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)


Maybe this is what you are looking for?

import matplotlib as mpl

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


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

So something like:

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


This worked for me [x.set_linewidth(1.5) for x in ax.spines.values()]

0

精彩评论

暂无评论...
验证码 换一张
取 消