matplotlib bar chart: space out bars

前端 未结 4 1105
滥情空心
滥情空心 2021-01-01 10:28

How do I increase the space between each bar with matplotlib barcharts, as they keep cramming them self to the centre. (this is what it currently looks)

impo         


        
4条回答
  •  爱一瞬间的悲伤
    2021-01-01 11:07

    Try replace

    plt.bar(range(len(my_dict)), my_dict.values(), align='center')
    

    with

    plt.figure(figsize=(20, 3))  # width:20, height:3
    plt.bar(range(len(my_dict)), my_dict.values(), align='edge', width=0.3)
    

提交回复
热议问题