官网大法好:点击直达官网
参考:
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='cornflower