matplotlib bar chart: space out bars

前端 未结 4 834
滥情空心
滥情空心 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 10:57

    set your x axis limits starting from slightly negative value to slightly larger value than the number of bars in your plot and change the width of the bars in the barplot command

    for example I did this for a barplot with just two bars

    ax1.axes.set_xlim(-0.5,1.5)

提交回复
热议问题