Spacing between bars in matplotlib hist() with thousands of bins

后端 未结 1 1139
迷失自我
迷失自我 2020-12-20 12:20

I\'m making histograms using matplotlib\'s hist() function or bar(), and I want to use >10,000 bins (one bin to represent the counts at each coordinate of a large entity). I

1条回答
  •  时光说笑
    2020-12-20 12:54

    The parameter rwidth specifies the width of your bar relative to the width of your bin. For example, if your bin width is say 1 and rwidth=0.5, the bar width will be 0.5. On both side of the bar you will have a space of 0.25.

    Mind: this gives a space of 0.5 between consecutive bars. With the number of bins you have, you won't see these spaces. But with fewer bins they do show up.

    enter image description here

    0 讨论(0)
提交回复
热议问题