python 绘制柱状图

import numpy as np
import matplotlib.pyplot as plt
 
 
N = 16
S = (58210, 56532, 57694, 57233, 52160, 46809, 53868, 47431, 58450, 56935, 58201, 54838, 59654, 58298, 59446, 59668)
C = (1664, 3342, 2180, 2641, 7714, 13065, 6006, 12443, 1424, 2939, 1673, 5036, 220, 1576, 428, 206)
M = (57842, 57933, 58840, 57991, 52329, 51141, 52218, 48621, 58694, 56973, 57562, 55923, 58916, 59425, 59652, 57229)
W = (2032, 1941, 1034, 1883, 7545, 8733, 7656, 11253, 1180, 2901, 2312, 3951, 958, 449, 222, 2645)



# d=[]
# for i in range(0,len(S)):
#     sum = S[i] + C[i]
#     d.append(sum)
# M = (10, 11, 7, 11, 8, 6, 6, 5, 3, 3, 7, 5, 9)
#menStd = (2, 3, 4, 1, 2)
#womenStd = (3, 5, 2, 3, 3)
ind = np.arange(N)    # the x locations for the groups
width = 0.35       # the width of the bars: can also be len(x) sequence
 
fig, ax = plt.subplots()
ax.bar(ind - width/2, S, width, label='train_10_0')
ax.bar(ind - width/2, C, width, bottom=S, label='train_10_1')
ax.bar(ind + width/2, M, width, label='train_20_0')
ax.bar(ind + width/2, W, width, bottom=M, label='train_20_1')
 
plt.ylabel('Scores')
plt.title('Scores by group and gender')

plt.xticks(ind+width*3, ['ss']*16)
plt.xticks(rotation=-45) 
plt.legend()
# plt.ylim(45000, 60000)
 
plt.show()
posted @   赫凯  阅读(59)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
点击右上角即可分享
微信分享提示