编程语言
首页 > 编程语言> > Python 消除条形图的边框

Python 消除条形图的边框

作者:互联网

链接:
https://www.5axxw.com/questions/content/bupt0a
自己的代码试验:
生成GBDT的特征重要性排序图

from pylab import mpl
mpl.rcParams['font.sans-serif'] = ['SimHei'] # 指定默认字体/Microsoft YaHei
mpl.rcParams['axes.unicode_minus'] = False # 解决保存图像是负号'-'显示为方块的问问题

gbdt_importance = model.feature_importances_
index = X_fmt.columns
gbdt_feature_importance = pd.DataFrame(gbdt_importance.T, index=index,columns=['score']).sort_values(by='score', ascending=True)

# 水平条形图绘制
a = gbdt_feature_importance.plot(kind='barh', legend=False,figsize=(10,9),fontsize=13,width=0.6,linewidth=None,edgecolor = 'white')
a.spines['top'].set_alpha(0.01)
a.spines['right'].set_alpha(0.01)

plt.show()![在这里插入图片描述](https://www.icode9.com/i/ll/?i=84865fa32a364476bdccad6e46b6ea31.png?,type_ZHJvaWRzYW5zZmFsbGJhY2s,shadow_50,text_Q1NETiBA5LyN5bKz5YeM,size_20,color_FFFFFF,t_70,g_se,x_16#pic_center)



标签:index,Python,mpl,feature,边框,importance,gbdt,条形图
来源: https://blog.csdn.net/weixin_44860769/article/details/120602656