python[]列表数据画柱状图

import numpy as np
import pylab
import matplotlib.pyplot as plt

%matplotlib inline
x=[0,1,2,3,4,5,6,7,8,9,10]

skeresult=[0.9009584664536742, 0.9585987261146497, 0.9555555555555556, 0.8575949367088608, 0.945859872611465, 0.9741100323624595, 0.9367088607594937, 0.9240506329113924, 0.9588607594936709, 0.9810126582278481, 0.9648562300319489]
rgbresult=[0.9201277955271565, 0.9936305732484076, 0.9746031746031746, 0.9082278481012658, 0.9522292993630573, 0.9838187702265372, 0.9651898734177216, 0.939873417721519, 0.9746835443037974, 0.9968354430379747, 0.9968051118210862]
fusionresult=[0.964856,1.0,0.993650,0.977848,0.974522,0.993527,0.984177,0.971518,0.990506,1.0,0.993610]

def autolabel(rects):
    for rect in rects:
        height = rect.get_height()
        plt.text(rect.get_x()+rect.get_width()/2.-0.2, *height, '%s' % float(height))

name=['punch','kick','push','pat','point','hug','pass','pocket','handshake','toward','away']
total_width,n=0.6,3
width=total_width/n

a=plt.bar(x,skeresult,width=width,label='ske',fc='y')
for i in range(len(x)):
    x[i] = x[i]+width
b=plt.bar(x,rgbresult,width=width,label='rgb',tick_label=name,fc='g')
for i in range(len(x)):
    x[i] = x[i]+width
c=plt.bar(x,fusionresult,width=width,label='fusion',fc='r')


plt.xlabel('class')
plt.ylabel('acc')
plt.title('NTUtp Classification Accuracy')
plt.xticks(rotation=45)
plt.xlim(x[0]-0.5, x[i]+0.1)
plt.ylim(0.85, 1.0)
plt.savefig("NTUtpAccuracy.png")
plt.show()

在这里插入图片描述

def autolabel(rects):
    for rect in rects:
        height = rect.get_height()
        plt.text(rect.get_x()+rect.get_width()/2.-0.2, 1*height, '%s' % float(height))


x1=[0,1,2]

result1=[0.9416]
result2=[0.9641]
result3=[0.9858]

name=['skeleton']
total_width,n=0.9,3
width=total_width/n

a=plt.bar(x1[0],result1,width=width,label='ske',tick_label='ske',fc='y')

b=plt.bar(x1[1],result2,width=width,label='rgb',tick_label='rgb',fc='g')

c=plt.bar(x1[2],result3,width=width,label='fusion',tick_label='fusion',fc='r')
autolabel(a)
autolabel(b)
autolabel(c)

plt.xlabel('model')
plt.ylabel('acc')
plt.title('NTUtp Classification Accuracy')
plt.legend()
plt.xlim(-0.5, 2.5)
plt.ylim(0.9, 1.0)
plt.xticks(x1,['ske','rgb','fusion'])
plt.savefig("NTUtpmodelAccuracy.png")
plt.show()

在这里插入图片描述

  • 1
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值