官网大法好:点击直达官网
参考:
1)多列:Grouped bar chart with labels
2)堆叠:Stacked bar chart
我的:
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
labels = ['C3', 'C4', 'C5', 'C6']
im_ip = [20, 34, 30, 35]
cg_ip = [25, 32, 34, 20]
cg_lp = [2, 3, 4, 2]
x = np.arange(len(labels)) # the label locations
width = 0.35 # the width of the bars
fig, ax = plt.subplots()
#x操作水平位置
rects1 = ax.bar(x - width, im_ip, width,color='cornflowerblue', label='M1 IP')
rects2 = ax.bar(x, cg_ip, width, color='orange',label='M2 IP')
#bottom操作堆叠位置
rects3 = ax.bar(x, cg_

本文介绍了如何使用Python的matplotlib库创建多列堆叠图,详细讲解了从官方文档获取信息的方法,并提供了参考示例和作者的实现效果。
最低0.47元/天 解锁文章
1289

被折叠的 条评论
为什么被折叠?



