首页 > 解决方案 > Python 组条形图问题

问题描述

我试图创建可以同时比较时间及其平均值的组条形图。数据如下: 在此处输入图像描述

    fig, ax = plt.subplots()
    bar_width = 0.35
    ind=np.arange(0, len(app_groups['TIME']))
    p1=ax.bar(ind+bar_width,app_groups['TIME'],bar_width)
    p2=ax.bar(ind+bar_width,app_groups['Mean'],bar_width)
    ax.legend((p1[0], p2[0]), ('TIME', 'MEAN'))
    plt.show()

但是,我刚刚得到了 Stacked Bart Chart,这不是我想要的。 在此处输入图像描述

标签: pythonpython-3.xmatplotlib

解决方案


推荐阅读