首先对山东新高考模拟考的成绩进行总体描述:
fig = make_subplots(rows=4,cols=2, #4行2列
subplot_titles=(‘所有考生’,“物理”, “历史”, “化学”, “地理”, “生物”, “政治”),
specs=[[{‘colspan’: 2},None],[{},{}],[{},{}],[{},{}],
]) #specs参数定义了如何分配视图区间, 本案例中的“specs=[[{}, {}],[{‘colspan’: 2},None]]”表示其他行的两个子图平均分配区间, 第一行的第一个子图占据 2列的区间, 并且不存在第二个子图
fig.add_trace(go.Scatter(
x = raw_data[‘分数段’],
y = raw_data[‘所有考生本段人数’],
fill = ‘tozeroy’,
mode = ‘lines’,
marker = dict(
size = 8,
color = ‘rgb(88, 182, 192)’
)),
row=1, col=1,
#保存图片
img_file = os.path.join(img_dir, ‘img1.svg’)
fig.write_image(img_file, scale=1)
fig.show()
原文链接:https://blog.csdn.net/2401_83641634/article/details/137806092?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522171852711516800211576680%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=171852711516800211576680&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-12-137806092-null-null.nonecase&utm_term=2024%E9%AB%98%E8%80%83%E6%88%90%E7%BB%A9