Menu

Barbell Plot

In this tutorial, we’ll demonstrate how to draw a Barball Plot in Glimpse to visualize the differences in life expectancy (in years) between men and women across 16 OECD countries.

Below is the data you will need for this tutorial:


Country Male Female Difference
Slovakia 67.8 73.4 5.6
Hungary 68.9 74.5 5.6
Mexico 70.1 75.6 5.5
Poland 65.4 73.5 8.1
Lithuania 62.1 76.8 14.7
Czechia 67.5 78.2 10.7
Colombia 72.1 77.4 5.3
Estonia 64.3 78.6 14.3
Chile 74.3 78.9 4.6
South Korea 77.7 83.7 6.0
Finland 78.9 84.2 5.3
New Zealand 78.9 84.5 5.6
Australia 79.3 85.6 6.3
Israel 77.9 86.3 8.4
Slovenia 76.6 88.7 12.1
Japan 81.2 89.6 8.4


First, import this data into Glimpse (copy, then in Glimpse on the top menu go Data > Add Source > Clipboard). These field tokens will appear:

image1


To draw the first set of point markers, change the mark type to Circle, drag the field Male into the encoding X and the field Country into Y.

image2

At the moment, the point markers are too small. So to increase their size, go Viz > Mark > Size and set the Size to 15 pt.

After, go Viz > Mark > Color and set the Base to any color and set the Opacity to 100%.

Then, go Viz > Mark > Stroke and set the Stroke Color to a black and the Width to 3 pt.

image3


In Layers, right-click / ctrl-click the Circle layer and select Duplicate Selection from the menu.

image4

After, drag the field Female into the encoding X to replace the Male field.

image5


In Viz > Mark > Color, change the Color to another color to represent the female values for life expectancy.

image6


Now it’s time to draw the connecting line. On the top menu, go Layer > Add Layer > Rule. Then, move the fields Male to X, Female to X2 and Country to Y.

image7


Go Viz > Mark > Stroke. Set the Color to black, the Width to 3 pt, and the Opacity to 100%. The connecting lines might overlapping with the colored points:

image8


If this happens, go into Layers and right-click / ctrl-click the Rule layer and select Send to Back from the menu to fix this problem.

image9


Now we need to tidy up the x-axis. First, select one of the Circle layers and press one of the fields in the X encoding (either Male or Female). Then go Viz > Encoding > Title and type in “Age”.

image10


There’s still too much empty space on the chart, therefore, we need to adjust the value scale. To do this, go Viz > Encoding > Scale > Domain. In Values, press the + button, set the type to Number and enter in 60. Press the + button again and enter 90.

image11


Now the chart should look like this:

image12

This concludes this tutorial on drawing a Barbell Plot. If you want to further customize your chart, please read the documentation.