python pyplot 可视化之绘制柱状图

可视化操作是工程师必备技能。在算法开发中,可视化能够辅助调试。本文对pyplot绘制柱形图做记录。

今天我欲对se_net中权重的学习情况进行可视化研究,从而判断出哪个通道/特征占据主导因素。其中使用pyplot进行可视化。jupyter notebook代码如下:

%matplotlib inline
%config InlineBackend.figure_format = 'svg'
#se权重
outputs = [0.9999635,  0.8995363,  0.13885525, 0.12847622, 0.11337245, 0.11435881,
  0.11065625, 0.11901541, 0.11137064, 0.14423777, 0.99997544, 0.02447405,
  0.03595051, 0.02142572, 0.02746158, 0.01961504, 0.03209742, 0.02768629,
  0.0280421]
#特征标签
tags = ["n_points","speed","north","northeast","east","sourtheast",
   "sourth","sourthwest","west","northwest","line_number","line_north",
   "line_northeast","line_east","line_sourtheast","line_sourth","line_sourthwest",
   "line_west","line_northwest"]

fig,ax=plt.subplots()
ax.bar([i+1 for i in range(19)],outputs, width=0.5)
ax.set_xlabel("feature")  #设置x轴标签
ax.set_ylabel("importance")  #设置y轴标签
ax.set_title("feature importance")  #设置标题
#添加x坐标对应的label
plt.xticks([i+1 for i in range(19)],tags,rotation=90)
plt.show()  #显示图像

  • 2
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值