Exploring different ways of displaying multiple bar charts (stacked, grouped, overlaid, and relative)
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 x axis. Figure 5.9 shows the different ways in which we can do that when visualizing two variables, a and b:
The four bar charts in the preceding diagram show the same information, but in different ways. This can be set using the barmode
parameter. With relative, bars are displayed on top of one another, with negative values below, and positive values above, the zero line. If you set it to group, then bars will be displayed next to one another. With overlay, bars are displayed in front of one another, and by default, we get some transparency in order to see both bars. Finally, if you set it to stack, you...