Grouped Bar Chart
In this tutorial, we’ll demonstrate how to draw a Grouped Bar Chart in Glimpse to visualize the income distribution (per year in thousands of USD) across four age groups in four different countries (A, B, C, D).
Below is the data you will need for this tutorial:
|Age||Country||Income ($, 1000s per year)|
|18 - 25||A||10.5|
|18 - 25||B||12.8|
|18 - 25||C||9.6|
|18 - 25||D||13.2|
|26 - 35||A||6.2|
|26 - 35||B||7.2|
|26 - 35||C||5.6|
|26 - 35||D||8.2|
|36 - 60||A||15.4|
|36 - 60||B||13.1|
|36 - 60||C||17.6|
|36 - 60||D||18.5|
First, import this data into Glimpse (copy, then in Glimpse on the top menu go Data > Add Source > Clipboard). These field tokens will appear:
Change the mark type to Bar and then move the field Income into X, Age into Y, Country into Row, and Age into Color.
The visualization is taking up a lot of space, so time to reduce the size. Go Viz > Layer > Layout and type 150 pt into Height.
Press the field Age in the Y encoding and then go Viz > Encoding and deactivate Title.
To change the colors of the bars, first press the field Age in the Color encoding, and then go Viz > Encoding > Scale > Range and tick Ordinal.
To move the legend to the top of the chart, go Viz > Encoding > Legend > Layout and set the placement to the Outer Top.
Switching the Focus
If you want to switch the bars being grouped by country to being grouped by age group, then click and drag the field Country from the Row encoding into the Y encoding to switch it with the Age field.
This concludes this tutorial on drawing a Grouped Bar Chart. If you want to further customize your chart, please read the documentation.