...

/

Exploring Different Ways of Displaying Multiple Bar Charts

Exploring Different Ways of Displaying Multiple Bar Charts

Get familiar with popularly used techniques to display bar charts in a Dash application.

When we want to display values for different countries but for the same years, we have several options for how to display multiple bars on each position of the xx axis. The Jupyter Notebook set up below shows the different ways in which we can do that when visualizing two variables, “a” and “b:”

Please login to launch live app!

The four bar charts in the preceding example show the same information but in different ways. This can be set using the barmode parameter.

  • relative: This displays the bars on top of one another with negative values below and positive values above the zero line.

  • group: This displays the bars next to one another.

  • overlay: This displays bars in front of one another, and by default, we get some transparency in order to see both bars.

  • stack: This displays the bars on top of one another, like “relative,” but in this case, the negative values cancel out the positives, as we saw for values “2” and “4” in the last chart. This is great if we want to compare proportions of each value to the total, especially if they all add up to the same total.

Creating the income share DataFrame

Let’s take a look at the five columns that show the share of income for each of the five quintiles of countries’ populations. ...