Reader small image

You're reading from  Interactive Dashboards and Data Apps with Plotly and Dash

Product typeBook
Published inMay 2021
Reading LevelBeginner
PublisherPackt
ISBN-139781800568914
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Elias Dabbas
Elias Dabbas
author image
Elias Dabbas

Elias Dabbas is an online marketing and data science practitioner. He produces open-source software for building dashboards, data apps, as well as software for online marketing, with a focus on SEO, SEM, crawling, and text analysis.
Read more about Elias Dabbas

Right arrow

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:

Figure 8.2 – A histogram of the Gini indicator with two bins

Figure 8.2 – A histogram of the Gini indicator with two bins

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:

Figure 8.3 – A histogram of the Gini indicator with 500 bins

Figure 8.3 – A histogram of the Gini indicator with 500 bins

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...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Interactive Dashboards and Data Apps with Plotly and Dash
Published in: May 2021Publisher: PacktISBN-13: 9781800568914

Author (1)

author image
Elias Dabbas

Elias Dabbas is an online marketing and data science practitioner. He produces open-source software for building dashboards, data apps, as well as software for online marketing, with a focus on SEO, SEM, crawling, and text analysis.
Read more about Elias Dabbas