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()
本文来自博客园,作者:赫凯,转载请注明原文链接:https://www.cnblogs.com/heKaiii/p/17137373.html
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本