Customizing the histogram by modifying its bins and using multiple histograms
We can change the number of bins through the nbins
parameter. We will first see the effect of using two extreme values for the number of bins. Setting nbins=2
generates the chart in Figure 8.2:
As you can see, the values were split into two equal bins, (20, 39.9) and (40, 59.9), and we can see how many countries are in each bin. It's quite simple and easy to understand, but not as nuanced as the histogram in Figure 8.1. On the other hand, setting nbins=500
produces the chart in Figure 8.3:
It is now much more detailed, maybe more detailed than useful. When you set too many bins, it is almost like looking at the raw data.
The default number of bins resulted in the bin size being intervals of five. Now...